andysweet
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Thanks for your reply.
Sorry, I should’ve been clearer, I’m still getting the messages today.
I’m having a similar problem.
The “Related Posts” shown for a post in the backend of WordPress are more or less a perfect match, but looking at the post itself (ie at the front end) I have different, less well-matched, posts and it’s the same 6 related posts appearing on all blog posts.
For example:
https://www.stravaiging.com/art-design/calton-hill-and-the-scottish-national-portrait-gallery/
https://www.stravaiging.com/edinburgh/the-royal-botanic-garden-edinburgh/
https://www.stravaiging.com/edinburgh/a-rooftop-view-of-edinburgh/
I’m not using a caching plugin, and am using a custom template:
<?php if ($related_query->have_posts()):?> <div class="row brown"> <div class="block-heading2 font30 font-white">Related pages</div> <div class="column grid_12"> <?php while ($related_query->have_posts()) : $related_query->the_post(); ?> <?php $img = ''; if ( has_post_thumbnail() ) { $img = get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'title' => $title, 'alt' => $title ) ); } else { $attachments = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => 1 ) ); if ( count( $attachments ) > 0 ) { $img = array_shift( $attachments ); $img = wp_get_attachment_image( $img->ID, 'related-thumbnail', true ); } } $extra_class = ''; if ( $img == '' ) { $img = '<img src="https://www.domain.com/noimage-150x150.jpg">'; } ?> <div class="column grid_2"> <div class="block150 orange shadow-half"> <div class="block-link"> <a href="<?php the_permalink() ?>" rel="bookmark"> <div class="block-link-container"> <div class="block-inner150"> <?php echo $img; ?> </div> <div class="block-inner150"> <div class="block-heading-centre font20 font-white link-white"> <?php the_title(); ?> </div> </div> </div> </a> </div> </div> </div> <?php endwhile; ?> <div style="clear: both"></div> </div> </div> <?php endif; ?>
Any ideas why this is happening?
Viewing 2 replies - 1 through 2 (of 2 total)