My main issue is that I have a couple of unusual spots on the homepage of my new site’s WordPress theme: http://www.jessicacantlope.com
I believe they both relate to the same issue, but I’m not entirely sure. I’m at the end of my rope as far as testing and searching goes…
First, the top area with the thumbnails. It’s a WP Query to load the most recent 5 posts with featured images in the custom post type “portfolio”, but for some reason it’s only loading 2 posts that are NOT in that post type.
(Note: because of the way I’ve styled that section for now, you’d only be able to see all 5 with a maximized browser window on a 1080p monitor. With most monitors, you should be able to see at least 3-4…if they were showing up right now.)
That section begins like this…
<?php $portquery = array( 'post_type' => 'portfolio', 'posts_per_page' => 5 ); $portfeature = new WP_Query($portquery); ?> <?php while ($portfeature->have_posts()) : $portfeature->the_post(); ?>
The whole section looks like this: http://pastebin.com/KNkUMXzR
I’ve made sure that every post, especially Portfolio posts, has a featured image, so there shouldn’t be any issues with that. If I increase the number of posts per page, more of all post types will show up, but I shouldn’t need to do that, and it really should just show portfolio posts. Since I’ve been adding more posts and altering other things, this has changed. Originally (but only for the first couple of days) it was showing as many posts as it should have. Slowly, it started losing posts, though I was adding more.
My second issue is with the “recent” posts list in the footer. If you look at it right now, you’ll see 6 links to posts. I set it to show 8. When I inspect the code in that area, I see two sections with links to posts that don’t exist (they’re not drafts or anything), without any text to properly display them. Also, the second link visible from the top, “RSS Feed”, is not a post, although for some reason it has a post link, which leads to a 404: http://www.jessicacantlope.com/2013/12/11/rss-feed/
In fact, RSS Feed is a link I added to my custom menu the other day under Social. Other links I added in my custom menu, mostly links to categories, have shown up like this in my recent posts list in the footer. I think this (or those other not-posts showing up) is what is causing the weird posts offset in the portfolio thumbnails listing and footer list, but I’m not sure, because they’re both being weird in slightly different ways (there are no ‘ghost links’ in the portfolio part, for example).
That footer links section looks like this:
<?php $recently = new WP_Query( array( 'post_type' => array( 'post', 'portfolio' ), 'posts_per_page' => 8 ) ); ?> <ul> <?php while ($recently->have_posts()) : $recently->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul>
Any help would be appreciated. I’ve been trying to read about WP Query more but I’m still not sure what I’m doing wrong — I just know that queries like these have worked as expected in the past (on templates that admittedly didn’t use custom menus or post types).
- The topic ‘Links added to custom menu showing up in recent post queries!’ is closed to new replies.