• Resolved tsalagi

    (@tsalagi)


    Howdy. I am writing a theme with a custom options menu and settings pages. Can someone explain to me if I should use a plugin for some of my functionality rather than including it in the functions file? What is the criteria for deciding whether to create a plugin or use the functions file? My concept of plugins is that they should be used to share with others as a stand alone to add functionality to any theme. It seems that it would be inefficient to write all the separate files for a plugin when it is a function of the theme being created.
    Thanks for your thoughts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t really know what the criteria would be.

    I tend to include all the functions I think of as integral to my theme, with my theme

    But I tend to organize the functions in different files then include them in my functions.php

    Not sure if that’s really the best way to do it….it just keeps my functions file from getting huge

    Things like sidebars, custom post types, taxonomy, etc I code directly into functions.php

    Then I do things like custom comments callback, or a large block of code to add an admin theme options menu in separate files with names to help my memory, like comment-callback.php and theme-options.php

    and in my functions.php just include them
    require_once ( get_stylesheet_directory() . '/theme-options.php' );
    etc…

    but basically, if I was going to let someone use my theme, and I consider the functionality to be something that is needed in the theme, I include it in the theme rather than in a plugin

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Some (most!) of the plugins are quite complicated and supporting them in a theme directly gets tedious.

    If you want the options/functionality/feature to be available in your theme, then you might want to use function.php. That way the features stay with your theme and the users do not need to download addtional files.

    If you want to recommend that your theme users use those plugins but leave it up to them, then in your readme.txt file you can place pointers to those plugins and just add if..then support in your theme files for those plugins.

    Thread Starter tsalagi

    (@tsalagi)

    Thanks to both of you. I have my theme planned just as both of you put it. Especially using separate files to store large code blocks and calling those files from the functions.php file. Very clear.

    Thanks again

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugins vs Using Fucntion file’ is closed to new replies.