I've been trying to fix this for weeks now.
I want to display a certain kind of posts on all my pages at the top. The code should be located in the header.php
. It will display sponsors, and the post will only be showing the featured image.
To do this I've tried using Blog-in-Blog and Category List Posts. Both great plug-ins to display a certain category. I've used do_shortcode
to display the list, because originally the posts can only be displayed through the_content();
of a page using [blog-in-blog id=7]
or whatever.
My problem is that it will display the posts on ALL pages on my website, except for the front-page. I really can't understand this. The "Category List Posts"-plugin simply doesn't display anything, but the "Blog-in-Blog"-plugin displays an error message:
ERROR: Blog-in-Blog shortcodes can only be used in pages, not posts.
But it's not a post. It's a page, right?
This is part of my header.php
-file (if that could help):
<body <?php body_class(); ?>>
<header id="header">
<!-- Content -->
</header>
<div id="sponsors">
<div class="wrap">
<h1><span>Our Corporate/Business Sponsors</span></h1>
<?php echo do_shortcode("[catlist content=yes title_class=header-title title_tag=h2 id=17 thumbnail=yes thumbnail_size=50,50 numberposts=20]"); ?>
</div>
</div>
WP_Query
and output it yourself.