In a project that I am working on the requirement is to add colored dots to the right of Post titles. The color of these dots should indicate what category the Posts belong to.
Here's how it can be done.
wp-content/themes/genesis/lib/structure/post.php says:
The genesis_post_title_text filter is applied on the text of the title
We shall use this filter to inject a span tag after linked titles of all Posts. 'span' (vs a div) because we want the dots to appear to the right and not below the title text.
Code in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
How can I replace the existing title with my title code or I can add this next to post-title?
the_title(); global $numpages; echo ‘ (‘.$numpages.’ Images)’;
Hi Sridhar,
Another wonderful tutorial – thank you.
If i wanted to achieve the coloured dots at the beginning of the post titles, rather than at the end, how could this be achieved?
Many thanks in advance,
Annabel
Great post unfortunately I’m not seeing any dots.
I’m using a fresh install of Foodie theme. I’ve added code in functions screen with Dynamik Extender and also placed code in Foodie functions.php file. Looking at the html it doesn’t appear the code is being used at all.
http://the-lowcarb-diet.com/beta/
I tried dropping the span class and simply adding hello
Sridhar, great post and works fine except I’m trying to figure out how to have this display just on my archive list titles and not on the actual page titles. So far no luck so was hoping you could point me in the right direction? Thanks
Use this code in functions.php: http://pastebin.com/raw/EE3S0aAC
Thanks Sridhar, I just fixed it by changing
if ( is_singular( ‘page’ ) ) {
return $title;
to:
if ( is_singular( array( ‘articles’, ‘books’, ‘podcasts’, ‘videos’, ‘webinars’ ) ) ) {
return $title;
}
Now the archive lists, of my CPT’s, have the icons and my single pages don’t.
Thanks again for pointing me in the right direction!