• On my site, I’m noticing that the deeper I try and look into certain archived paginate elements, I’m getting a lot of broken links. Having trouble pinpointing why.

    Examples:

    Category — this works fine. Page 1, Page 13
    Tags — this doesn’t work. Page 1, Page 8 (this will work up to Page 5, then break)
    Authors — this also doesn’t work. Page 1, Page 162

    I was using this article to troubleshoot, but I’m still having issues narrowing down the actual issue causing Tags and Authors to break, but not Category. Within the Settings of Permalink, I’m using the custom structure of “/%category%/%postname%/” which I originally thought might be tied to this, but I’m not quite sure.

    Here’s the line of code I have on search results:

    <div class="latest-wrapper">
            <?php if ( have_posts() ) : ?>
            <h2 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'mvc' ), '<span>' . get_search_query() . '</span>' ); ?></h2>
            <h5><?php echo paginate_links( $args ); ?></h5>
            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>
            <?php
    				/**
    				 * Run the loop for the search to output the results.
    				 * If you want to overload this in a child theme then include a file
    				 * called content-search.php and that will be used instead.
    				 */
    				get_template_part( 'content', 'search' );
    				?>
            <?php endwhile; ?>
            <br clear="all" />
            <h5><?php echo paginate_links( $args ); ?></h5>
            <?php
    	else :
    		echo '<h2>No content found</h2><p>Please try another search or view our <a href="/archive/">Archives</a>.</p>';
    	endif; ?>
            <hr />
            <h2> Search</h2>
            <?php get_search_form(); ?>
            <br clear="all" />
          </div>

    Any help appreciate — thank you!

    • This topic was modified 7 years, 6 months ago by Matthew.
Viewing 2 replies - 1 through 2 (of 2 total)
  • have you made any edits to index.php, archive.php, or author.php (in case any of those template files exist) of your theme?

    the line of code I have on search results

    from what file is the posted code?

    Thread Starter buysoap

    (@buysoap)

    Haven’t done any editing in index, archive or author, no. The paginate is in archive, similar to the above; no author.php, though.

    As for that code, that’s from my search.php file. All that is in archive.php is:

    <h5><?php echo paginate_links( $args ); ?></h5>
            <?php
    	while (have_posts()) : the_post(); 
    
        get_template_part('content'); 
    		
    	endwhile;
    	
    	else :
    		echo '<p> No content found</p>';
    	endif; ?>
            <br clear="all" />
            <h5><?php echo paginate_links( $args ); ?></h5>
            <br clear="all" />
    • This reply was modified 7 years, 6 months ago by buysoap.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issues with Paginate in Search’ is closed to new replies.