Forums

[resolved] Change title color of a specific tagged post (3 posts)

  1. gpzblog
    Member
    Posted 1 year ago #

    I have a blog, where I have sponsored blog posts. I would like these posts to stand out, so I would like to change the font color of the title, and add a small image next to it saying "sponsored".

    How can I make make these changes to the posts tagged with "sponsored"? Thanks in advance!

  2. newsdevice
    Member
    Posted 1 year ago #

    Take a peek at the Conditional Tags page, here is a simplistic example:

    `
    <?php if (has_tag('sponsored')) { ?>
    <div class="sponsored-style"><?php the_title(); ?></div>
    <?php } else { ?>
    <div class="regular-style"><?php the_title(); ?></div>
    <?php } ?>
    `

    Of course you would need to add the sponsored-style (whatever you name it) to your theme's CSS file.

  3. gpzblog
    Member
    Posted 1 year ago #

    Thanks a lot! Worked like a charm:)

Topic Closed

This topic has been closed to new replies.

About this Topic