- This topic has 6 replies, 3 voices, and was last updated 3 years, 12 months ago by
Tom.
-
AuthorPosts
-
March 25, 2019 at 2:29 pm #849651
Elaine
How do I add action conditionally for a right sidebar heading on Blog Archive & Single Posts?
Using GP hooks, here is what I have so far, but this will show up in every right sidebar, and I have more than one. Interested in how to write it conditionally to only appear on Blog.
add_action( ‘generate_before_right_sidebar_content’,’es_insert_title_right_sidebar’ );
function es_insert_title_right_sidebar() { ?>
<h4 class=”es-right-sidebar-title”>Filter Blog Posts</h4>
<?php }GP Premium 1.7.8March 25, 2019 at 3:46 pm #849714David
StaffCustomer SupportHi there,
you can use Conditional tags:
https://docs.generatepress.com/article/using-hooks-conditional-tags/
Or better still use the Hook Element which has the display rules built in:
https://docs.generatepress.com/article/hooks-element-overview/
I would go for the latter ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 28, 2019 at 1:16 pm #852850Elaine
Thanks David
I was able to add the heading in the right sidebar & a filter list menu under by applying the Widget Context plugin to an HTML widget and a Tag Cloud Widget. So the list menu is created from a Tag Cloud, in order to be able to filter Blog Posts.
Now I am unhappy with the result in terms of the Breadcrumbs. If I click on a tag of ‘Mindset’ in the sidebar, instead of Breadcrumb: Home > Blog > Mindset, it appears Home > Mindset.
Of course the url of that Post is: name-of-site/tag/mindset/. So I guess i’ve taken the Blog reference out of it altogether.
How can I filter these Blog Posts so that I can maintain a Blog Breadcrumb logic?
I’m using Tags, but would be in the same boat with Categories . . .?
Thank you in advance for your help!March 28, 2019 at 1:20 pm #852856Elaine
I forgot to mention I already have a Hook Element for Yoast Breadcrumbs activated for a location of ‘everywhere’.
March 28, 2019 at 3:54 pm #852954Tom
Lead DeveloperLead DeveloperHi there,
I’m not sure how to alter the output of the breadcrumbs themselves, unfortunately. That might be a question for Yoast support.
This article might help: https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/
I see there’s a “Show blog page” option you can select.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 28, 2019 at 4:59 pm #852993Elaine
Thank you!
March 29, 2019 at 9:31 am #853643Tom
Lead DeveloperLead DeveloperYou’re welcome ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.