using file for snippets in functions.php

Community Forums Forums General Discussion using file for snippets in functions.php

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  UT Mod 1 year, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37352

    UT Mod
    Participant
    Post count: 159

    Is it possible to put a snippet in file (something.php) and call it in functions.php on appropriate place?

    I mean, instead of pouring different codes for php in widget, adding fields in user bio, adding image sizes etc in functions.php, won’t it be a good idea to put all that in a seperate .php file and then call it in functions.php?

    If yes then how?

    Thanks.

    #37376

    Andrea Rennick
    Keymaster
    Post count: 1225

    It’s actually less efficient because there are more calls to separate files.

    And yes, you can do it with php includes. That’s not WordPress specific, it’s just php.


    **forum signature**
    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    Twitterholic

    #37379

    UT Mod
    Participant
    Post count: 159

    Ok, so using this approach in functions.php or in Simple Hooks won’t be the best practice, right?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.