WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WordPress SEO by Yoast] First page of multi-page post displays as page 0

[Plugin: WordPress SEO by Yoast] First page of multi-page post displays as page 0

  • 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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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)

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] First page of multi-page post displays as page 0’ is closed to new replies.