Support » Plugins and Hacks » Page Title for Content Pages

Page Title for Content Pages

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author AntoineH


    2. I will add it to my to-do list.

    If you can’t wait for me to finish this, you can always override the title with your own code:

    Plugin Author AntoineH


    Nevermind, I hacked it together.

    add the following line to /football-pool.php

    if ( ! is_admin() ) add_filter( 'wp_title', array( 'Football_Pool', 'change_wp_title' ), null, 2 );

    add the following function to classes/class-football-pool.php

    public static function change_wp_title( $title, $sep ) {
    	if ( is_page() && is_main_query() ) { // http://pippinsplugins.com/playing-nice-with-the-content-filter/
    		$page_id = get_the_ID();
    		switch ( $page_id ) {
    			case Football_Pool_Utils::get_fp_option( 'page_id_teams' ):
    				$team = new Football_Pool_Team( Football_Pool_Utils::get_int( 'team' ) );
    				if ( $team->id != 0 ) $title = "{$team->name} {$sep} {$title}";
    			case Football_Pool_Utils::get_fp_option( 'page_id_stadiums' ):
    				$stadium = new Football_Pool_Stadium( Football_Pool_Utils::get_int( 'stadium' ) );
    				if ( $stadium->id != 0 ) $title = "{$stadium->name} {$sep} {$title}";
    			case Football_Pool_Utils::get_fp_option( 'page_id_groups' ):
    				$group = Football_Pool_Groups::get_group_by_id( Football_Pool_Utils::get_int( 'group' ) );
    				if ( $group != null ) $title = "{$group->name} {$sep} {$title}";
    	return $title;

    This also adds the stadium name and group name to the corresponding pages.

    Thank you for your prompt response. Unfortunately hasnt changed 🙁

    Plugin Author AntoineH


    I tested the code on my local install and it’s working perfectly.

    Could be a conflict with your theme. Can you try changing the ‘null’ value in the first line to a number higher than 10, e.g. 50?

    if ( ! is_admin() ) add_filter( 'wp_title', array( 'Football_Pool', 'change_wp_title' ), 50, 2 );

    Hi ,

    I tried this again but to no avail. I also disabled an SEO plugin that i thought might have affected this.

    Title shows “teams” and Meta Title is the same


    BTW – I updated to latest version of Football Pool also.

    Plugin Author AntoineH


    Did you do the changes to the files before or after the update? If before, then you’ll have to do the changes again.

    If you did the changes after the update I can’t really think of a reason why this doesn’t work for you. You can try a search for the string ‘wp_title’ in your wp-content directory. To find out which other plugins or themes are hooking into this filter.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Page Title for Content Pages’ is closed to new replies.