WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
First page of multi-page post displays as page 0 (3 posts)

  1. kvignos
    Member
    Posted 2 years ago #

    WordPress version: 3.4.1
    WordPress SEO version: 1.2.5

    I did this:
    In Yoast WordPress SEO: Titles & Metas, Post Types tab, I entered the following for the Title template:
    %%title%% - Page %%pagenumber%% | %%sitename%%

    I expected the plugin to do this:
    I expected "Page %%pagenumber%%" to show "Page 1" for page one.

    Instead it did this:
    Instead, it shows "Page 0" for page one.

    Also, if the "View All" link is clicked, "Page 0" is displayed.

    The page numbering works if two lines are added in wp-content/plugins/wordpress-seo/inc/wpseo-functions.php in wpseo_replace_vars() at line 107 (I show between comments lines below):

    $pagenum = 0;
    $max_num_pages = 1;
    if ( !is_single() )
    { $pagenum = get_query_var('paged');
    if ($pagenum === 0)
    $pagenum = 1;
    if ( isset( $wp_query->max_num_pages ) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) $max_num_pages = $wp_query->max_num_pages;
    } else { $pagenum = get_query_var('page'); 
    
    // ------------------------------------------------------------
    // first page
    if (($pagenum === 0) || ($pagenum == '')) $pagenum = 1; 
    
    // view all
    if ($pagenum == '') $pagenum = ': View All'; 
    
    // ------------------------------------------------------------ 
    
    $max_num_pages = substr_count( $post->post_content, '<!--nextpage-->' );
    if ( $max_num_pages >= 1 )
    $max_num_pages++; }

    We'd like to request a patch for this - thanks!

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. suguru.hirahara
    Member
    Posted 1 year ago #

    It is still working for the latest development version.
    Open the file, go to the line 137, then insert "if (($pagenum === 0) || ($pagenum == '')) $pagenum = 1;". That's it! (don't forget to make a backup)

  3. pawanmit
    Member
    Posted 1 year ago #

    I updated to the latest release (Version 1.3.4.3) but this bug is still not fixed.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.