WordPress.org

Support

Support » How-To and Troubleshooting » Different Title Color for todays post

Different Title Color for todays post

  • I post around 10-posts-a-day. My post’s title color is Red and now, I want to show ‘current’ days’s post to be of Black and all rest posts to be the usual Red.

    What should I do to achieve the same?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael
    Forum Moderator

    @alchymyth

    locate the code for the title output, possibly within the loop of index.php and single.php.

    compare the post’s publish date with the current date, and add a special css class to the title’s element;

    example:

    <h2 class="entry-title<?php if( get_the_time('Y-m-d') == date('Y-m-d') ) echo ' today'; ?>"><?php the_title(); ?></h2>

    then add to style.css:

    .entry-title.today, .entry-title.today a { color: #000; }

    details depend on the used theme – please post a link to your site.

    my site. And am using a genesis framework. So, is it possible to do something in function.php or in hooks to achieve the same ?

    Michael
    Forum Moderator

    @alchymyth

    as genesis framework is a commercial theme, please contact the theme’s seller for support with your question.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different Title Color for todays post’ is closed to new replies.