• My site is auto generating some code for older/newer posts on the category page, but when you click “older” the link does not work. it is generating /blog/page/2 from /blog/
    here is my code:

    <?php get_header(); ?>
    
    		<!-- Main -->
    			<article id="main">
    
    <?php
    $args = array ( 'category' => 1, 'posts_per_page' => 10);
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :	setup_postdata($post);
     ?>
    
    <section class="wrapper style4 container">
    <div class="content">
    <section>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    <div class="row">
    <div class="5u"> <A href="<?php the_permalink() ?>" class="noborder"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumbnail'); } ?></a></div>
    <div class="7u">
    <header>
    <h1 class="entry-title blog"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?> "rel="bookmark"><?php the_title(); ?></a>
    </header>
    <section class="entry-content">
    <?php $content = get_the_content();
          $content = strip_tags($content);
          echo substr($content, 0, 250);
    ?>... <ul class="buttons"><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="button">Full Post</a></li></ul>
    </div>
    </section>
    </div>
    </div></article>
    </section></div></section>
    
    <?php endforeach; ?>
    </article>
    
    <div class="content"> <div class="row">
    <nav>
    <div class="6u"><?php next_posts_link(sprintf( __( '%s', 'blankslate' ), '<span class="button">&larr;  Older Posts</span>' ) ) ?>
    </div>
    <div class="6u"><?php previous_posts_link(sprintf( __( '%s', 'blankslate' ), '<span class="button">&rarr; </span>' ) ) ?></div>
    </nav>
    </div></div>
    </section>
    
    <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ymous anon

    (@chicagodunn)

    I tried the “fix” plugin, but it doesn’t seem to be doing anything for me. Any help would be greatly appreciated, as I’d like to be to have visitors peruse the pages.

    Thread Starter ymous anon

    (@chicagodunn)

    Was able to solve my problem using this

    add_action('init','yoursite_init');
    function yoursite_init() {
      global $wp_rewrite;
    		//add rewrite rule.
                    add_rewrite_rule("author/([^/]+)/page/?([0-9]{1,})/?$",'index.php?author_name=$matches[1]&paged=$matches[2]','top');
                    add_rewrite_rule("(.+?)/page/?([0-9]{1,})/?$",'index.php?category_name=$matches[1]&paged=$matches[2]','top');
                    $wp_rewrite->flush_rules(false);
    }

    from

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination not working Category Page’ is closed to new replies.