• Is anyone familiar with this issue:

    on my homepage, underneath all the posts previews, there is a link that says Older Posts on the left. Right now, if I click it, I end up looking at the same collection of posts, and a similar thing happens if I try to navigate through older and recent page links at the bottom of that page.

    my site is at dev. travelwithcastle.com

    it’s almost ready to launch otherwise, so I’d love any advice.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Can you replicate the problem using the default Twenty Thirteen theme with all plugins deactivated?

    Thread Starter dequecolour

    (@dequecolour)

    Can you elaborate? This is a twenty twelve child theme. If I change to twenty thirteen, do you want me to use the same child files I’ve created? I’ll do whatever you think I need to do to resolve the issue, but I’m a little unclear on what you need.

    right now, the linked site is a frame for a WordPress.com site based on Twenty Ten – if that site is where you have problems with, please ask at https://en.forums.wordpress.com/

    if your problem is with a self-hosted WordPress site and theme, please post a link directly to where the problem can be inspected.

    does your Twenty Twelve child theme use any custom queries in the home page template?
    does the problem persist if you temporarily deactivate all plugins?
    does the problem persist if you temporarily switch to the original unedited Twenty Twelve theme?

    Thread Starter dequecolour

    (@dequecolour)

    thx — i will try the above questions and report back.

    the site is dev.travelwithcastle.com

    the 2010 site you visited did not included the “dev.” because i accidentally typed an unneeded space up above in my first hyperlink to the site. So, just to clarify it’s self-hosted at dev.travelwithcastle.com. You will see it is a twentytwelve child.

    Thread Starter dequecolour

    (@dequecolour)

    To answer your first question, “does your Twenty Twelve child theme use any custom queries in the home page template?” yes, I think so. To create the two columns, this is my index.php code for the child theme.

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query.
     * For example, it puts together the home page when no home.php file exists.
     *
     * Learn more: https://codex.www.ads-software.com/Template_Hierarchy
     *
     * @package WordPress
     * @subpackage Twenty_Twelve
     * @since Twenty Twelve 1.0
     */
    get_header(); ?>
    	<div id="primary" class="site-content">
    	<div id="content" role="main">
            <div style="margin-bottom: 20px;">
    <center> <?php if ( function_exists( 'soliloquy_slider' ) ) soliloquy_slider( '1420' ); ?>
    <br><br><br><br><br><br><br><br><br>
    <center>
    <img src="https://dev.travelwithcastle.com/wp-content/uploads/2013/08/RF1.jpg">
    </div>
    <div id="right-column">
    <?php $my_query = new WP_Query('category_name=favorites');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate[] = $post->ID ?>
      <?php get_template_part( 'content', get_post_format() ); ?>
      <?php endwhile; ?>
    </div>
    <div id="left-column">
    <?php $my_query = new WP_Query('category_name=Recents');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate[] = $post->ID ?>
      <?php get_template_part( 'content', get_post_format() ); ?>
      <?php endwhile; ?>
    </div>
    			<?php twentytwelve_content_nav( 'nav-below' ); ?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Thread Starter dequecolour

    (@dequecolour)

    i’m not sure why but switching to the twenty twelve theme temporarily caused my child theme to stop working altogether, so please don’t visit the site to address any q’s. It is no longer working in almost every sense, and I will need to rebuild it.

    review https://codex.www.ads-software.com/Pagination

    you will at least need to add the ‘paged’ parameter to your custom queries;
    example:
    $my_query = new WP_Query('category_name=recents&paged='.get_query_var('paged'));

    and totally modify this function <?php twentytwelve_content_nav( 'nav-below' ); ?> to possibly work with custom queries.

    also, custom queries should generally be ended with wp_reset_postdata();

    the whole template rewritten: https://pastebin.com/QeNvDzg3

    for more info, search the web for ‘wordpress multiple loops pagination’

    Thread Starter dequecolour

    (@dequecolour)

    Thanks. Using your code, I come up with this error on line 36:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/37/11572437/html/wp-content/themes/twentytwelve-child/index.php on line 36

    Line 36 looks fine to me, so I’m stumped.

    appreciate the info and have been reading around.

    might be a typing mistake (?)

    please use the pastebin (because the pastebin has line numbers) to post the full code – https://codex.www.ads-software.com/Forum_Welcome#Posting_Code

    Thread Starter dequecolour

    (@dequecolour)

    ok. i had just just copied your code directly from pastebin when i got that error which may not have been your intention.

    here is what i had previously which looks great but the Older Posts link does not work:

    https://pastebin.com/Xcyk9fgP

    here is your code from pastebin as i used it and which results in the above mentioned syntax error on line 36. (i feel like that error usually means a comma is missing or some such, but i don’t see anything like that in your code.)

    https://pastebin.com/sDa0Rn9y

    not sure why, but the pastebin https://pastebin.com/QeNvDzg3 seems to have some problems in line 35 and does not recognize the closing php tags properly:

    $do_not_duplicate[] = $post->ID ?>

    possibly manually retype this line, and add a semicolon after ID:

    $do_not_duplicate[] = $post->ID; ?>

    Thread Starter dequecolour

    (@dequecolour)

    doesn’t seem to make any difference. same error.

    plus the similar code prior to that for the right column lacks a semi colon after ID and results in no error. i even tried adding the semi colon both places to no avail

    only error is on line 36 which looks clean to me.

    very odd.

    apologies – indeed a typing mistake on my side ??

    edit line 33 of pastebin https://pastebin.com/QeNvDzg3 to look like:

    <?php $my_query = new WP_Query('category_name=recents&paged='.get_query_var('paged'));

    (the code was right in the post here, but there was one excess ‘ near the of the line in the pastebin)

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘older posts link not working’ is closed to new replies.