0

enter image description here

Hello all! I'm trying to add as you'll see in the image attached a small huffington post icon and accompanying text to some posts on my blog. I'd like to set up a category "Huffington Post" and when this category was checked for a new post, it would add the "As Published on.." text and Huff Post icon to the post. I don't want this code on every post just the posts that are denoted by this category. Any help is much appreciated! Cheers!!!

1 Answer 1

1

Have a look at in_category() in the codex. You would either insert this into your theme within the post loop or create a function in functions.php that'll insert the image and text you want when a post from that category is displayed on screen.

Here's a test bit of code I put together that works well in the Twenty Fourteen theme. I put it inside the loop in content.php as a quick test.

if (in_category(1)) { 
    the_title();
    echo "<p style='font-size:80px'>Category 1 Test</p>";
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.