0

Is there a code that i can place in the header that will call a certain div and the content i place inside it for every custom post type i have, Somthething like this.

 <?php if (is_post_type('pretty-little-liars') ) {echo '<div id="headerimg"><img src="http://tv-cafe.com/wp-content/uploads/2012/08/liars.png"></div>'; } ?>

I know that the code above doesn't work, but is there a way that i can call something like that for each post type i have, i will be placing this code in the header.

Also if anyone does have the solution could you please tell me where do i add a second line to the code that repeats the first line but with a different post type name?

1

I think that will only work in the loop, but what you can do outside of the loop is use

<?php
if (get_post_type() == 'pretty-little-liars') {
echo '<div id="headerimg"><img src="http://tv-cafe.com/wp-content/uploads/2012/08/liars.png"></div>'; 
} 
?>
  • Thank you that works.....but how do i add a second line – Terrell Anderson Aug 3 '12 at 1:01
  • When i create a second one it shows in the home page :( – Terrell Anderson Aug 3 '12 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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