• Resolved Dvd709

    (@dvd709)


    Hi guys,

    I have a thumbnails on my homepage that directly link to an information page of that certain thumbnail and it only works with one thumbnail, though the permalink on the thumbnail in included in my while. So all that happens is that you keep going to the details page of the LAST entered thumbnail.

    As well as for my previous/next postlinks on the details page to go to a different project, it for some reason changes the link of the page but shows the content of the same page it was on.

    I think both the permalink and post link have the same issue but I just don’t know how to solve this.

    Code:

    <div id= "thumbnail">
    <?php
    	  $args = array(
            'post_type' => 'project',
            'posts_per_page' => 10
          );
          $query = new WP_Query( $args );
          if ( $query->have_posts()) : ?>
          <ul>
    <?php   while ( $query->have_posts()) :  $query->the_post(); ?>
            <li>
    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium' ); ?></a>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </li>
    
    <?php endwhile; wp_reset_postdata();?>
          </ul>
    <?php endif; ?>
    </div>

    The above code is a while outside the standard while.

    <div class="navigation"><p> <?php previous_post_link()."/?p=".$post->ID; ?> </p></div>
    		<div class="navigation2"> <?php next_post_link('&laquo %link'); ?> </div>
    	</div>

    The above code is all in a while but it’s to much to paste.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Dvd709

    (@dvd709)

    I found out that when you click on one of the thumbs it redirects you to project/”thumb name”/ and that when I remove this from the query:

    'posts_per_page' => 1,

    that the other pages start to show up below it. What I also want to add in is that the pages that should show up, show up on single-project.php.

    The fact that I try a next/previous on a single.php, is this a faulty way of doing it if so what would be best to do when having a homepage thumb click to a page that should show info about them?

    Thread Starter Dvd709

    (@dvd709)

    Nevermind I solved it by changing:

    <?php
    	  $args = array(
            'post_type' => 'project',
            'posts_per_page' => 10
          );
          $query = new WP_Query( $args );
          if ( $query->have_posts()) : ?>

    To:

    <?php if ( have_posts() ) :
          while ( have_posts() ) : the_post(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Permalink and postlink not working’ is closed to new replies.