[Resolved] How do I manipulate the page titles?

Home Forums Support [Resolved] How do I manipulate the page titles?

Home Forums Support How do I manipulate the page titles?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #187890
    Pete

    How do I manipulate the header page titles? (the one in the browser tab, not the edit screen) I don’t want to install any plugins to change it.

    #187933
    Tom
    Lead Developer
    Lead Developer
    #188733
    Pete

    Where about is the code that sets the titles? I’m asking as I really need to set some powerful conditionals as as my titles

    • This reply was modified 8 years, 3 months ago by Pete.
    #188737
    Pete

    or how could I edit this snippet so that I can free add some wp template tags

    <?php add_action( ‘after_setup_theme’, ‘theme_functions’ );
    function theme_functions() {
    add_theme_support( ‘title-tag’ );
    }
    add_filter( ‘wp_title’, ‘custom_titles’, 10, 2 );
    function custom_titles( $title, $sep ) {
    //Check if custom titles are enabled from your option framework
    if ( ot_get_option( ‘enable_custom_titles’ ) === ‘on’ ) { ?>
    //Something like <?php if( is_sticky()) { ?>
    //               <?php } else { ?>
    //                <?php } ?>
    
    $title = “Some other title” . $title;;
    <?php }
    return $title;
    } ?>
    • This reply was modified 8 years, 3 months ago by Pete.
    #188803
    Tom
    Lead Developer
    Lead Developer

    This is already done in GP:

    add_theme_support( 'title-tag' );

    You’re on the right track with the wp_title filter – you just need to use the right conditionals and then return the titles.

    You might get some more in depth answers over on http://wordpress.stackexchange.com.

    #737267
    Pete

    resolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.