WordPress.org

Support

Support » Themes and Templates » function in function.php not pluggable.

function in function.php not pluggable.

  • MuViMoTV
    Member

    @muvimotv

    Hi,

    I’m making a child theme based on twenty fourteen theme and i need to change some of the function that are in function.php.

    Unfortunately function.php has not been made pluggable for that theme. I’ve copy pasted below some info that are on wordpress.org related to that…

    Is there a reason why these function are not pluggable? It’s a bit of a hassle to have to change the source of a parent theme, this mean that for every update changes need to be manually recoded…

    Could you guys please consider making the function pluggable…

    Thanks a lot 🙂

    TIP FOR THEME DEVELOPERS. The fact that a child theme’s functions.php is loaded first means that you can make the user functions of your theme pluggable —that is, replaceable by a child theme— by declaring them conditionally. E.g.:

    if ( ! function_exists( ‘theme_special_nav’ ) ) {
    function theme_special_nav() {
    // Do something.
    }
    }
    In that way, a child theme can replace a PHP function of the parent by simply declaring it beforehand.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘function in function.php not pluggable.’ is closed to new replies.