WordPress.org

Forums

Twenty Fourteen
function in function.php not pluggable. (5 posts)

  1. MuViMoTV
    Member
    Posted 1 year ago #

    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.

  2. MuViMoTV
    Member
    Posted 1 year ago #

    same goes for this:

    if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
    require get_template_directory() . '/inc/featured-content.php';
    }

    Why is this hardcoded to get the inc from the parent? can't you change that to actually check the child first and if not in the child then load parent?

    IMHO this theme is used a lot as a parent theme and it would be great to make it simpler for developers to customize it even more easily...

  3. carlo.cavaliere
    Member
    Posted 8 months ago #

    Hi MuViMoTV,

    I experienced the same issue in Travelify theme :\

    Did you find a fix, anyway?

  4. carlo.cavaliere
    Member
    Posted 8 months ago #

  5. carlo.cavaliere
    Member
    Posted 8 months ago #

    P.P.S. And here too:
    https://wordpress.org/support/topic/remove_action-not-working?replies=3

    Following these steps made me fix the problem of an unpluggable function. Let me know if it worked for you, too.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.