• Resolved IRW030370

    (@irw030370)


    I hope you can help me – please!

    This is my website: jerichoconsulting.co.uk

    You will note at the bottom of the homepage the blog posts are displaying incorrectly. These are supposed to display in date order with the most recent in the top left and the oldest of the four in the bottom right. The theme was developed for me by a web company; however just before we parted ways they botched an earlier error and it has left me with this.

    There is a specific page template for the front page and I roughly know where the relevant code is on that page for the recent blog posts, however I don’t know what exactly to replace; and with what!

    The code that I believe to be relevant to the section of the page in question is:

    <div class="read-all-about">
    	<div class="wrapper">
    		<div class="read-all-about-inner">
    			<div class="all-about-tittle"> <span>Read All About It!</span> </div>
    			<div class="all-about-blog">
    				<?php
    							$i = 1;
    							$query = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'DESC'));
    							if (have_posts()) : while ( $query->have_posts() ) : $query->the_post();
    							$postid = $post->ID;
    							if(get_field('blog_display') == "yes" && $i <= 4)
    							{
    								$link = get_permalink();
    								$title = get_the_title();
    								$attach_id = get_post_thumbnail_id();
    								$featured_image = wp_get_attachment_image_src( $attach_id,'full');
    								$excerpt = get_the_excerpt();
    								$date = get_the_date();
    
    						?>
    				<div class="blog-view <?php if($i%2 == 0) echo ' right-view"'; else echo '" style="float:left"';?> >
    					<div class="blog-img"> <a>"><img src="<?php echo $featured_image[0]; ?>" alt="<?php echo basename($featured_image[0]); ?>" /></a> </div>
    					<div class="blog-text"> <a>">
    						<h3><?php echo $title; ?></h3>
    						</a> <span><?php echo $date; ?></span>
    						<p>
    							<?php $str = $excerpt;
                                                  $string = (strlen($str) > 70) ? substr($str,0,70).'...' : $str;
                                                  echo $string;
                                            ?>
    							<a>">Continue reading</a></p>
    					</div>
    				</div>
    				<?php  $i++; }  ?>
    				<?php endwhile; ?>
    				<?php else: ?>
    				<div class="error">
    					<?php _e('Not found.'); ?>
    				</div>
    				<?php endif; ?>
    			</div>

    Can anyone help?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey there IRW030370,

    Hope you’re well! ??

    I think the post is showing correctly according to date ( recent to oldest ) as you can see here: https://prntscr.com/63n3bq

    Do you still need help for this?

    Looking forward for your reply! ??

    Take care,
    Calvin

    Thread Starter IRW030370

    (@irw030370)

    Hi Calvin

    Thanks for writing.

    No, these posts are displaying incorrectly. They should go: Top Left, Top Right, Bottom Left, Bottom Right. Like a Z shape.

    The top two posts are fine, but the third post is on the right (but not even square to the right) and the fourth post is below it (but may be in the right place if the third post is the one causing the problem).

    I don’t understand what is wrong with the code I posted.

    Your help with this would be welcomed.

    Kind regards

    Ian

    Thread Starter IRW030370

    (@irw030370)

    Can anyone help me? Please!

    ??

    Hey there IRW030370,

    Hope you’re well! ??

    I can see that the layout is now good. Do you still need help? If not, can you tell us how you fix it and mark this thread as resolved.

    Looking forward for your reply! ??

    Best Regards,
    Calvin

    Thread Starter IRW030370

    (@irw030370)

    The issue was with the stylesheet, not the page template – a bit of tinkering to the width of the excerpts and related images and we’re all good.

    Regards

    Ian

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Most recent blog posts displaying incorrectly’ is closed to new replies.