WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks - "Page Not Found" (4 posts)

  1. Tokyo54
    Member
    Posted 3 years ago #

    Hi all,

    I am having an issue where I cannot navigate to older posts on my blog, unless I use the defult style of permalinks.

    The site: http://www.notyouraveragelawyer.com

    Posts display fine up until page 4 when my own "posts not found" message appears. When using standard permalinks, this does not happen. It is only when I try to edit the permalink structure to a 'pretty permalink' structure that the posts cannot be displayed.

    My .htaccess is configured as follows

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Which I believe is correct.

    The issue does not seem to occur with the basic wordpress theme.

    Does anybody know a) how I can resolve this issue, and b)Which area I could troubleshoot within my themes files in order to try and find the issue.

    Thanks for your help.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Does your theme's index.php template file use a custom query ( query_posts() )?

  3. Tokyo54
    Member
    Posted 3 years ago #

    Yes Esmi it does,

    See below:

    if (is_paged()) :
    				query_posts($use_category ."showposts=".get_option("ocmx_home_page_posts")."&paged=".get_query_var('paged'));
    			elseif (is_home()) :
    				query_posts($use_category."showposts=".get_option("ocmx_home_page_posts"));
    			endif;
    
    			if (have_posts()) :
    				while (have_posts()) :	the_post();
    					setup_postdata($post);
                        // Fetch the PermaLink, Thumbnail and Video Metas
                        $get_post_video = get_post_meta($post->ID, "main_video", true);
                        $get_thumbnail = get_post_meta($post->ID, "other_media", true);
                        $link = get_permalink($post->ID);
    etc...

    Would the is_paged() option be to do with the issue?

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Possibly... Try replacing:

    if (is_paged()) :
    				query_posts($use_category ."showposts=".get_option("ocmx_home_page_posts")."&paged=".get_query_var('paged'));
    			elseif (is_home()) :
    				query_posts($use_category."showposts=".get_option("ocmx_home_page_posts"));
    			endif;

    with:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($use_category . 'posts_per_page=' . get_option('ocmx_home_page_posts') . '&paged=' .$paged );

Topic Closed

This topic has been closed to new replies.

About this Topic