-
AuthorPosts
-
August 23, 2024 at 5:07 pm #1465251
Hi guys,
in the latest enfold version 6.03
The following is supposed to add a widget to just the blog pages. This is no longer the case – The widget area is applying to all pages.
Please can you let me know how we resolve this?
// Add Widget above news pages
add_action( ‘ava_after_main_title’, ‘enfold_customization_blog_widget_area’, 50 );
function enfold_customization_blog_widget_area() {
dynamic_sidebar( ‘blogheaderwidget’ );
}August 23, 2024 at 5:19 pm #1465254Sorry the issue here is the hook above never used to load on shop pages. It now loads on all pages which is causing the button I would normally load on the shop to not work because both filter news and filter products buttons are visible.
Can we get a new hook that only adds a widget area to the Blog in the same way that the before shop look adds a widget area before the products in the shop?
This is quite urgent see this post for context: https://kriesi.at/support/topic/hook-to-add-widget-area-above-blog-loop/
August 23, 2024 at 5:26 pm #1465255See test area showing issue where my two widget areas are both showing on the shop when it only used to show one in the previous enfold version.
August 24, 2024 at 6:57 pm #1465306Hi,
You could add a check for the page that you want you show it on, for example if the page ID is “1028” use this:add_action( 'ava_after_main_title', 'enfold_customization_blog_widget_area', 50 ); function enfold_customization_blog_widget_area() { if ( is_page(1028) ) { dynamic_sidebar( 'blogheaderwidget' ); } }
or you can use the page slug like this:
add_action( 'ava_after_main_title', 'enfold_customization_blog_widget_area', 50 ); function enfold_customization_blog_widget_area() { if ( is_page('your-page-slug') ) { dynamic_sidebar( 'blogheaderwidget' ); } }
The WordPress Conditional Tags documentation state:
There is no conditional tag for the blog page. You have to use both is_home() and is_front_page() to detect this page, but those functions can be misused.
They offer a different solution, try reading it, but I think the two solutions above will work fine.
Best regards,
MikeAugust 26, 2024 at 1:02 pm #1465410Hi Mike,
Unfortunately what you have suggested doesnt work. BUT IT SHOULD!!!
Using the documentation guide – This works:
add_action( 'ava_after_main_title', 'enfold_customization_blog_widget_area', 50 ); function enfold_customization_blog_widget_area() { $check_tjnewswidget = true; if ( is_home() ) { $check_tjnewswidget = false; } if( !$check_tjnewswidget ) { dynamic_sidebar( 'blogheaderwidget' ); } }
Not quite as per documentation but I like using the true and false method of determining if something is a particular thing.
- This reply was modified 2 months, 3 weeks ago by thinkjarvis.
August 26, 2024 at 4:44 pm #1465423Hi,
Glad to hear that you have this sorted out, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Bug:Blog Header hooks no longer working properly’ is closed to new replies.