• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Alter title for paginated multi-page posts(add Page 2 etc)

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Alter title for paginated multi-page posts(add Page 2 etc)

This topic is: not resolved

Tagged: title

  • This topic has 9 replies, 2 voices, and was last updated 10 years, 1 month ago by Sonicview.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • May 17, 2015 at 3:35 pm #152503
    Sonicview
    Member

    When I write a post with multiple pages via the <!--nextpage--> tag all of the resulting pages share the same <title>. I would like to add the page number to the end of the title so that they are not all completely the same. My GWT is reporting duplicate titles because they are all the same.

    If a paginated post has the title "this is a post title" and I go to page two I want the title to become "this is a post title - Page 2" etc. Can anyone suggest how I can modify the title via my functions file? I'm using Metro-pro but I don't think it matter which theme. Thanks.

    May 18, 2015 at 12:13 pm #152584
    Sonicview
    Member

    Maybe I wasn't clear? I need to eliminate duplicate titles from paginated <!-- nextpage --> posts. Is there a way to add "Page 2", "page 3" etc to the end of the site title on paginated posts ?

    May 18, 2015 at 10:21 pm #152658
    Graham
    Member

    You would have to add a filter to genesis_post_title_text that checks the value of the $page variable.

    e.g.

    add_filter ('genesis_post_title_text', 'child_maybe_filter_title' );
    function child_maybe_filter_title( $title ) {
    	global $page;
    	if( $page > 1 ) {
    		$title .= ' (Page ' . $page . ')';
    	}
    	return $title;
    }

    My JustGiving page: https://www.justgiving.com/helping-graham-give

    May 18, 2015 at 10:27 pm #152660
    Graham
    Member

    Ah sorry, missed the part about GWT (Google Webmaster Tools) ... that will be to do with rel=canonical

    So probably a SEO plugin / settings option ?


    My JustGiving page: https://www.justgiving.com/helping-graham-give

    May 18, 2015 at 10:47 pm #152662
    Sonicview
    Member

    Nope, it's not a canonical issue, I don't want all paginated content pointing to page one via a canonical tag. The problem is that there seems to be no way to add "Page 2" etc to a multi-page post. The title on every page is the same. The options allow me to add the site name but there is no way to perform a conditional check for paged content from there.

    Your function should work, but doesn't for some reason. This is in the genesis header for my site

    'function genesis_do_title() {
    	echo '<title>';
    	wp_title( '');
    	echo '</title>';
    }'

    and it's called on and modified by

    function genesis_default_title( $title, $sep, $seplocation ) {
    
    	global $wp_query;
    
    	if ( is_feed() )
    		return trim( $title ); ETC....

    Here is the part specific to single pages, which I assume would be where to append the page number on multi-page posts?

    //* if viewing a post / page / attachment
    	
    	if ( is_singular() ) {
    		//* The User Defined Title (Genesis)
    		if ( genesis_get_custom_field( '_genesis_title' ) )
    			$title = genesis_get_custom_field( '_genesis_title' );

    I've tried turning off all plugins and turning on/off all SEO settings within Genesis and no go. It's not a cache issue either, the site doesn't run cache and I cleared browser cache on both computers I'm testing with. I feel so close yet... this is the most recent version of genesis btw and I run the metro-pro theme which shouldn't matter. Thanks for helping, this is driving me nuts.

    May 18, 2015 at 10:52 pm #152663
    Sonicview
    Member

    Ugh, wait, your function DID work but only at changing the titles on the page, not in the browser tab (HTML wp_head area). I'm lost as to why it would change the title for H1 on page but not the title in the browser tab ?? any other suggestions??

    May 18, 2015 at 11:44 pm #152679
    Graham
    Member

    Yes, sorry ... my function was only aimed at changing the titles on the page. I missed the part about GWT (Google Webmaster Tools) in your post.

    As genesis_default_title() only allows the user to set a custom title on a per-page or per-post basis - and is not further filterable, I feel you would have to remove that filter from wp_title() and then roll your own function.

    remove_filter('wp_title', 'genesis_default_title', 10, 3);
    add_filter('wp_title', 'child_default_title', 10, 3);
    function child_default_title(  $title, $sep, $seplocation  ){
      // etc
    }

    Seems like a lot of work and begs the question .. if you wish to have separate SEO titles for each section and not rel canonical , then I suspect you would need separate meta descriptions as well.. (otherwise GWT will moan about there being duplicate meta descriptions) - -- so why not post each section as a separate blog post and just link to the other related posts in the content?

    I'm happy to be educated here.

    No further suggestions, sorry.


    My JustGiving page: https://www.justgiving.com/helping-graham-give

    May 18, 2015 at 11:44 pm #152680
    Sonicview
    Member

    Adding the following delimited section to genesis/lib/structure/header.php works

    function genesis_default_title( $title, $sep, $seplocation ) {
    
    	global $wp_query;
    
    	if ( is_feed() )
    		return trim( $title );
    // attach page number to paginated pages... 
    	<strong>global $page;	
    	if( $page > 1 ) {
    		$title .= ' (Page  ' . $page . ')';
    	}
    // done attaching
    

    But is that safe and is there a function file equivalent so that I don't have to hard code it?

    May 19, 2015 at 12:07 am #152689
    Graham
    Member

    If you wished, you could remove that filter from wp_title() and add your own as indicated above:

    remove_filter('wp_title', 'genesis_default_title', 10, 3);
    add_filter ('wp_title','child_default_title', 10, 3);
    function child_default_title( $title, $sep, $seplocation ) {
    	global $wp_query;
    	global $page;	
    	if( $page > 1 ) {
    		$title .= ' (Page  ' . $page . ')';
    	}
    	// etc
    	return esc_html( trim( $title ) );
    }

    Or perhaps (?), disable the Genesis SEO entirely and use something like Yoast SEO which I believe gives the option to no-index subpages and add a %%page%% variable to the template.


    My JustGiving page: https://www.justgiving.com/helping-graham-give

    May 19, 2015 at 1:25 am #152696
    Sonicview
    Member

    We posted at the same time, sorry

    if you wish to have separate SEO titles for each section and not rel canonical , then I suspect you would need separate meta descriptions as well.. (otherwise GWT will moan about there being duplicate meta descriptions)

    I don't include descriptions on paged content, only on the first page, because in the absense of a description tag Google grabs text from the page which is fine with me(for now, I have bigger wordpress issues to tackle). Google also announced that you should not use rel-canonical to point to the first part of any series of pages UNLESS they are highly identical. They expanded on that in a few places and were very clear that it should not be used in that manner, nor should you place a noindex tag on page 2 onwards. If you use the rel next and rel prev tags Google will know it's a series and so noindex and rel canonical to page 1 are not needed.

    Anyway, I seem to have a larger problem. While the fix I posted above does work for my purposes I realized that it ONLY works because the plugin having troubles is pulling the info independently of the genesis loop, It does grab the information from genesis but it does not work anywhere else using the_permalink, not even in a twitter button, they all point to the first page.

    In fact I can't even use the_permalink or get_permalink anywhere as these do NOT grab the page number for me right now. Is genesis altering or moving the_permalink function somewhere ?

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble