One of the templates will grab the one of my last customs post type of post feature image to be the page header image. If I remove my custom post type loop, then feature image will be back to default WP page feature image.
How can I avoid header section pulling from my custom post type?
————-Here’s the code ———-
## footer.php ##
</div>
<?php
if(is_category()):
$cat_id=get_cat_id(single_cat_title('',false));
$img=get_option("taxonomy_".$cat_id);
$url=$img['img'];
else:
global $post;
$post_id = $post->ID;
if(has_post_thumbnail($post_id)):
$url=wp_get_attachment_url(get_post_thumbnail_id($post_id));
else:
$url=get_template_directory_uri().'/img/banner.jpg';
endif;
endif;
?>
<script>
$(function() {
$.vegas({
src:'<?php echo $url;?>' , fade:500,
});
$.vegas('overlay', {
src:'<?php bloginfo('template_directory');?>/img/06.png'
});
$('.carousel').carousel()
});
</script>
## template-page.php ##
`<div id=”test”>
<?php
$args=array(‘post_type’=>’services’,’meta_key’=>’level’,’orderby’=>’meta_value_num’,’order’=>’ASC’);
$query=new WP_Query($args);
while($query->have_posts()): $query->the_post();
?>
<a href=”<?php the_permalink();?>”>
<div class=”col-md-4 col our-services-page”>
<?php $font=get_post_meta(get_the_ID(),’_font_image’,false);?>
<span class=”icn <?php echo $font;?>”></span>
<div id=”overly”>
<?php the_post_thumbnail(‘medium’); ?>
<?php echo get_field(‘excerpt’, get_the_ID());?>
</div>
<!– <img src=”<?php bloginfo(‘template_directory’);?>/img/icons.png”> –>
<h3><?php the_title();?></h3>
</div>
</a>
<?php
endwhile;
?>
</div>`
Thanks!
]]>if(is_category()):
$cat_id=get_cat_id(single_cat_title('',false));
$img=get_option("taxonomy_".$cat_id);
$url=$img['img'];
else:
global $post;
$post_id = $post->ID;
if(has_post_thumbnail($post_id)):
$url=wp_get_attachment_url(get_post_thumbnail_id($post_id));
/*code I add*/
elseif(is_page(886)):
$url=get_template_directory_uri().'/img/banner.jpg';
/* end of code I add*/
else:
$url=get_template_directory_uri().'/img/banner.jpg';
endif;
endif;
?>
Thank you
]]><?php wp_reset_query(); ?>