This topic has 4 replies, 2 voices, and was last updated 9 years by sealagency.
-
Author
-
January 15, 2015 at 19:39 #42236sealagencyParticipant
Hello,
For the blog section of my site, i created a special sidebar “blog”.
On article pages and list item by category pages i would like to display the sidebar ‘blog’ instead of the sidebar by default.
I had this problem for events (events +) fix by a function in function.php of sweetdate child. But I can not find the right conditions for blog pages.COPY CODEadd_action('wp', 'set_sidebar', 10); function set_sidebar() { global $_wp_sidebars_widgets; //if( is_singular( 'incsub_event' ) ){ page event single if( is_post_type_archive( 'incsub_event' ) || is_singular( 'incsub_event' ) || is_tax( 'eab_events_category' )) { $_wp_sidebars_widgets['sidebar-1'] = $_wp_sidebars_widgets['sidebar-12']; } }
what to put in the place of:
if( is_post_type_archive( 'incsub_event' ) || is_singular( 'incsub_event' ) || is_tax( 'eab_events_category' ))
Thanks
January 24, 2015 at 02:01 #43279AbeKeymasterHi,
if you want to check if you are on an article page then try
if(is_single())Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.January 24, 2015 at 15:18 #43320sealagencyParticipantHello Abe,
if( is_single()) || is_archive() || is_tax()){
Ok, it’s work very well, the specific sidebar to articles (blog posts) is now displayed for the blog post, but this specific sidebare is displayed instead of the specific sidebar to events see the code of my first message.
like i have events is_post_type_archive( ‘incsub_event’ ) || is_singular( ‘incsub_event’ ) || is_tax( ‘eab_events_category’ with ‘incsub_event’ and ‘eab_events_category’ for select only the events it’s necessary to have something that filters only the article of the blog for display the good sidebar.
in summary:
for events i want sidebar-12 instead sidebar-1
for blog articles i want sidebar-13 instead sidenbar-1I hope you hundertand me …
Thanks
January 27, 2015 at 22:22 #43657AbeKeymasterYou need to make your custom logic unfortunately of use a plugin like Content Aware sidebars
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.January 31, 2015 at 17:17 #44220sealagencyParticipantHello Abe,
With Content Aware sidebars i can make what i want, it’s ok now!
It’s a shame that we can not do it simply with codeThanks Abe!
-
AuthorPosts
The topic ‘change sidebar on list category article’ is closed to new replies.