WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven
Make modifying of Twentyeleven in child themes easier (3 posts)

  1. GeraldS
    Member
    Posted 2 years ago #

    I'd love to have more of Twentyelevens functions in functions.php enclosed in (!if function_exists()) so people developing child themes can modify it easier.

    Currently I'd love to override twentyeleven_content_nav, but I'm stuck with either modifying the original functions.php and have it overwritten on the next update, or copy every file over that calls the function, which kinda screws the idea of a child theme.

    http://wordpress.org/extend/themes/twentyeleven/

  2. Dave333
    Member
    Posted 2 years ago #

    Can't you create a Functions.php file in your child theme and use that instead?

  3. GeraldS
    Member
    Posted 2 years ago #

    Dave, sadly it's not that easy. See here:

    Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

    That's why at the top of functions.php theme developers are urged to use (!if function_exists()) enclosures for functions, so they can be overridden easily. Too bad the WordPress developers don't heed their own advice.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic