Add widget areas to detail sidebar top and in between owner block and content

This topic contains 6 replies, has 3 voices, and was last updated by  Stiofan O’Connor 8 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #45051

    jkirker
    Lifetime Member
    Post count: 298

    I have been searching the forums for a hook reference or something but have been unable to find what I’m looking for.

    I want to add two widget areas on the detail page.

    First, before the social block and second, after the owner/edit block as in the image below.

    Any help would be appreciated.

    #45061

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    there is hook to filter the social sharing buttons html: geodir_social_sharing_buttons_html

    Here I explain how to add an image on top of them and that should help you:

    https://wpgeodirectory.com/support/topic/display-featured-image-on-detail-sidebar/#post-28088

    Similarly, you can use geodir_detail_page_more_info_html

    Let us know how you went.

    Thanks

    #45063

    jkirker
    Lifetime Member
    Post count: 298

    Thank you Paolo…

    I’m halfway there… Here’s the code. Now to get a widget into the second area.

    Anyone have any thoughts or suggestions? Is there another hook there?

    If anyone else wants to do this, here’s the code:

    
    
    //Create Detail Page Top Sidebar Widget to Page
    register_sidebar( array(
    	'id'          => 'geodir-details-sidebar-top',
    	'name'        => 'GD Details Sidebar Top',
    	'before_widget' => '<div class="geodir-company_info geodir-details-sidebar-top">',
    	'after_widget'  => '</div>',
    ) );
    
    // Add Detail Page Top Sidebar Widget to Page
    function details_sidebar_top ( $sidebar_top_content ) {
    	dynamic_sidebar('geodir-details-sidebar-top');
    	return $sidebar_top_content;
    }
    add_filter( 'geodir_social_sharing_buttons_html', 'details_sidebar_top', 10, 1 );
    #45064

    Paolo
    Site Admin
    Post count: 31206

    Same thing but with the second filter suggested: geodir_detail_page_more_info_html

    Thanks!

    #45065

    jkirker
    Lifetime Member
    Post count: 298

    Thanks again. I ended up figuring it out after re-reading what you wrote.

    Can you think of a way to add a widget or JS code between two Custom Fields?

    I thought of maybe adding an HTML field and locking it down to admin only, however it doesn’t allow for a default value. That’s also not optimal either though should the default value be added to the database in the event it needed to be updated.

    Thanks again.

    #45148

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi jkirker,

    Maybe this is the second hook u are after, just filter the html and tag on what you want?

    https://wpgeodirectory.com/docs/codex/geodirectory_filters/geodir_edit_post_link_html/

    Thanks,

    Stiofan

    #45149

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Oops i think i read that wrong, these might be the hooks you are after.

    
    
    /**
                         * Called before a custom fields is output on the frontend.
                         *
                         * @since 1.0.0
                         * @param string $html_var The HTML variable name for the field.
                         */
                        do_action('geodir_before_show_' . $html_var);
                        /**
                         * Filter custom field output.
                         *
                         * @since 1.0.0
                         *
                         * @param string $html_var The HTML variable name for the field.
                         * @param string $html Custom field unfiltered HTML.
                         * @param array $variables_array Custom field variables array.
                         */
                        if ($html) echo apply_filters('geodir_show_' . $html_var, $html, $variables_array);
    
                        /**
                         * Called after a custom fields is output on the frontend.
                         *
                         * @since 1.0.0
                         * @param string $html_var The HTML variable name for the field.
                         */
                        do_action('geodir_after_show_' . $html_var);
Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket