WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to Include Shared Functionality on 2+ Pages (3 posts)

  1. Patrick Rauland
    Member
    Posted 2 years ago #

    Hi there,

    I have a medium sized WP site with a custom theme that has a couple different page types, each with their own file name (ex. page-foo.php). If I want to include some php functionality on just a couple of these pages what is the best way to do so without repeating code?

    Should I use bare bones PHP to include a php file? Is there some functionality built into WordPress that will make that easier?

    Also, what if I want to include shared form processing on these pages? Could I still use one of the above solutions?

  2. vtxyzzy
    Member
    Posted 2 years ago #

    It might be possible to create a function in functions.php and call it from any template that needs it.

  3. Patrick Rauland
    Member
    Posted 2 years ago #

    @vtxyzzy Thanks. That is probably going to be my best bet. I appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Topic