WordPress.org

Ready to get started?Download WordPress

Forums

Best way to override theme's functions.php ? (6 posts)

  1. wpress2010
    Member
    Posted 1 year ago #

    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?

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    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

  3. esmi
    Forum Moderator
    Posted 1 year ago #

    Nope. You need to use a child theme.

  4. wpress2010
    Member
    Posted 1 year ago #

    Thanks - are there available plugins that I could use?

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    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).

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic