Support » Fixing WordPress » Best way to override theme's functions.php ?

  • I want to add a single line to Twenty-Eleven’s functions.php file, to allow my site to use the Page Navi plugin.

    It’s easy enough to add the line to the existing theme file, but that pretty much makes future theme updates not-so-smooth, as I will need to remember to go in and add the line again.

    I am able to override theme CSS with an external CSS file via the Custom CSS plugin. By keeping the custom CSS in a separate file, it isn’t affected by theme updates. Is there a way to do a similar thing with a PHP file, without having to resort to a child theme?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yup, a plugin. I make a special plugin for all my sites. Pretty much anything that could go in functions.php can go into a pluing

    You need to see what it is you are overriding and do it appropriately… hook, filter, etc

    esmi

    (@esmi)

    Forum Moderator

    Nope. You need to use a child theme.

    Thanks – are there available plugins that I could use?

    esmi

    (@esmi)

    Forum Moderator

    I’d argue that building a plugin is a lot more complex that creating a child theme. Takes about 5 minutes to do the latter. There are even pre-built starter child themes on http://quirm.net/themes (bottom of the page).

    Yeah @esmi, I tend to agree with you.

    Only half my answer got posted (and twice somehow) – I’m having issues on the site right now woth posting it seems….

    The child theme with just the minimum you need is the ideal and intended way to do it…. and it keeps the upgrades safe

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Best way to override theme's functions.php ?’ is closed to new replies.