• I am trying (but failing) to change the background colour of specific individual posts only – in a sense to highlight them so that they stand out from all the others on the page.

    How can I do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • hello,

    Maybe you can « hack » your template by add php
    <?php if (check the doc to color by name of post or cat == “red”){ ?>
    <div class=”red”>
    <?php }?>
    <? template feature >

    <?php if (check the doc to color by name of post or cat == “red”){ ?>
    </div>
    <?php }?>

    Thread Starter timesharestaff

    (@timesharestaff)

    which template would I place this in and how do I select the specific posts that this would work on?

    Thanks

    You could make a special category for it and add the name of the category to you posts class attribute.

    <?php
    foreach((get_the_category()) as $cat) {
    echo $cat->cat_name . ' ';
    } ?>

    Then it’s just a matter of making a special css rule for that class.

    To flag the specific posts, why not just make a custom field? That’s assuming the category idea doesn’t work for you of course.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To Change The Background Colour of specific posts only?’ is closed to new replies.