WordPress.org

Ready to get started?Download WordPress

Forums

Football Pool
Page Title for Content Pages (8 posts)

  1. joemillano
    Member
    Posted 9 months ago #

    Hi ,

    Just downloaded and installed today. Applied the WC 2014 Matches.

    All looks great except 2 things.

    1) CSS of some other plugin broken - I will figure that out.
    2) Meta Page Title for all Teams is "teams" etc Any future enhancements to resolve this?

    Cheers!

    https://wordpress.org/plugins/football-pool/

  2. AntoineH
    Member
    Plugin Author

    Posted 9 months ago #

    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:
    http://codex.wordpress.org/Template_Tags/wp_title#Customizing_with_the_filter

  3. AntoineH
    Member
    Plugin Author

    Posted 9 months ago #

    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}";
    				break;
    			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}";
    				break;
    			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}";
    				break;
    		}
    	}
    
    	return $title;
    }

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

  4. joemillano
    Member
    Posted 9 months ago #

    Thank you for your prompt response. Unfortunately hasnt changed :(

  5. AntoineH
    Member
    Plugin Author

    Posted 9 months ago #

    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 );

  6. joemillano
    Member
    Posted 9 months ago #

    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

    Cheers

  7. joemillano
    Member
    Posted 9 months ago #

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

  8. AntoineH
    Member
    Plugin Author

    Posted 9 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic