Viewing 4 replies - 1 through 4 (of 4 total)
  • no need for the function to be pluggable, as it is added as a filter function;
    see: add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );

    remove it from the filter, and add your own function.

    Thread Starter evolts

    (@evolts)

    Hi alchymyth,

    thanks for your answer!
    So I’ve to remove it from inside myown_wp_title function? Because I can’t remove it from my functions.php file, since is loaded before the parent one.
    This a overhead of add and remove of functions, isn’t it?

    Bye,
    eV

    this for example works for me, in a child theme of Twenty Twelve:

    add_action('after_setup_theme','adjust_twentytwelvechild_wp_title');
    
    function adjust_twentytwelvechild_wp_title() {
    	remove_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );
    	add_filter( 'wp_title', 'twentytwelvechild_wp_title', 10, 2 );
    }
    
    function twentytwelvechild_wp_title( $title, $sep ) {
    	global $paged, $page;
    /*your wp_title code here*/
    	return $title;
    }
    Thread Starter evolts

    (@evolts)

    Thanks alchymyth, I’ll go this way.

    Just for the records, I still think this is an overhead of function calling, that can be avoided just making the twentytwelve_wp_title function pluggable.

    Bye,
    eV

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Overriding twentytwelve_wp_title in a child theme’ is closed to new replies.