Tuesday, 1 October 2013

How to add functions in wordpress child theme

One thing when Wordpress - Add a Widget space to a template and add a widget to it.  that I was not sure about when adding the menu is how to do that in a child theme.

There's a fairly clear instruction to this in the functions.php of the 'twentytwelve' theme.  and that is

 * When using a child theme (see http://codex.wordpress.org/Theme_Development and
 * http://codex.wordpress.org/Child_Themes), you can override certain functions
 * (those wrapped in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before the parent
 * theme's file, so the child theme functions would be used.

In the case of a menu item; all you need to do is save a new file as functions.php in your child and add

    'name' => 'Banner Ads',
    'id' => 'bannerads',

that's enough.  as you're adding to a function .

Check Add functions to your wordpress child theme for more information. []

No comments: