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 10 years, 4 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: sidebar add widget top
-
AuthorPosts
-
July 8, 2015 at 4:07 pm #45051
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.
July 8, 2015 at 5:58 pm #45061Hi,
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
July 8, 2015 at 7:14 pm #45063Thank 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 );July 8, 2015 at 8:07 pm #45064Same thing but with the second filter suggested: geodir_detail_page_more_info_html
Thanks!
July 8, 2015 at 8:33 pm #45065Thanks 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.
July 9, 2015 at 3:19 pm #45148Hi 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
July 9, 2015 at 3:29 pm #45149Oops 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); -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket