• I am not the original designer on this project, but I was tasked with reskinning an existing site, https://www.fitwithus.com/blog/

    Since I reskinned the site there has been 2 issues with the wordpress install, 1) the frontpage just shows random entries and not the 5 most recent and 2) if you click on any blog post it points back to the most recent blog post.

    Can anyone shed any light on why this might be happening? I’ve tried to trace through and see if I changed some code while skinning, but haven’t found anything that would cause these issues.

Viewing 4 replies - 1 through 4 (of 4 total)
  • modsuperstar,

    Did you check for orderby=rand in the main page loop, this may be causing the random posts here. I’m curious what the php is on the post titles it should be something to the effect of: <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> this would them link back to the actual post.

    https://www.doc4design.com

    Thread Starter slideaway

    (@modsuperstar)

    I guess the problem isn’t actually a redirection problem, but the content not showing up. If you go to https://fitwithus.com/blog/2009/06/18/choosing-a-skipping-rope/ you don’t end up at the desired article, you end up at the most recent article, which is obviously wrong. There is nothing wrong with the links per say, it’s the content that is being displayed on the next page.

    I tried looking for an orderby=rand statement and didn’t find anything in my index.php file.

    Thread Starter slideaway

    (@modsuperstar)

    Made a little headway here discovered that one of the sidebar elements was what was dictating whether the frontpage items would be random or not.

    <!-- posts -->
    	<?php
    		if (is_single()) {
    			$posts_widget_title = 'Recent Posts';
    		} else {
    			$posts_widget_title = 'Recent Posts';
    		}
    	?>
    
    	<div class="widget">
    		<div class="boxContent">
    		<h3><?php echo $posts_widget_title; ?></h3>
    		<ul>
    			<?php
    				if (is_single()) {
    					$posts = get_posts('numberposts=10&orderby=post_date');
    				} else {
    					$posts = get_posts('numberposts=5&orderby=rand');
    				}
    				foreach($posts as $post) {
    					setup_postdata($post);
    					echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
    				}
    				$post = $posts[0];
    			?>
    		</ul>
    		</div>
    </div>

    I’m haven’t used WordPress or PHP for any large amount of time, but I’m guess there is a naming conflict or something going on here. Previously the sidebar had been to the right as opposed to the left, so I’m wondering if the issue might be tied to it previously being declared after the content.

    Thread Starter slideaway

    (@modsuperstar)

    Looks like I sorted it out. Moving the sidebar to be declared before the content items seemed to be the big snafu. Ended up rolling back the re-skin and positioning the sidebar using a different method.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘All my entries redirecting to the latest blog post’ is closed to new replies.