do i need a framework if creating own theme?

Hi,

Fairly new to this so be kind!

Want to create some wordpress sites but dont really want to use preset themes but create my own. Should I be using a framework? Have downloaded and used genesis for one site but it just seems to make it more complex than doing it from scratch?

is the done thing to always use a framework? what do others do?

also i have a need for a mutisite installation ( as it uses marketpress ). should I use a frame work for that if so why/why not? thanks!

  • Jack Kitterhing

    Hi there @bill,

    Hope you're well today and thanks for your question.

    It's a very personal choice, deciding to use a framework or not, generally, it's quicker to use a framework, rather than completely custom code from scratch.

    Also with a framework if using a popular one, you get a well known proven code base and there are multiple forms and user groups that can assist as they've used the same.

    We have a great roundup here of different frameworks https://premium.wpmudev.org/blog/free-wordpress-framework/ :slight_smile:

    Thanks!

    Kind Regards
    Jack.

  • Jack Kitterhing

    Hi there @bill,

    Hope you're well today :slight_smile:

    Multisite wouldn't have any special considerations for this, it would indeed be more of a personal choice.

    Currently a lot of themes are using the underscores framework, due to the clean well written code and it's easy to expand on.

    With well known frameworks, you get the comfort in knowing that the code is well written and widely used, it also speeds up development time.

    Thanks!

    Kind Regards
    Jack.

  • Tarei

    I typically use Foundation 5 to build themes. You can use Flair: https://github.com/sennza/Flair or a little more beginner friendly is AW Theme's Reactor: http://demo.awtheme.com/reactor/#

    Roots http://roots.io is available for Bootstrap based themes - pick you fav and build a site or two with each.

    The workflow is hugely different for each, but for both - I've used WooThemes FlexSlider 2 for the slider implementation.

    Good luck

  • Imperative Ideas

    Framework can mean a lot of things.

    1. The PHP framework (or the WordPress parent theme)

    At its most basic level, a framework is a set of PHP functions and related CSS definitions that can be called into service at any time. When developing my own framework, I leaned really heavily on the WordPress system for conditionally registering code depending on whether the theme supports it.

    By running a supported features function in my parent using require_if_theme_supports(), I can then reflect that in the child's functions with add_theme_support().

    Thus if I have this in the parent:

    /* Add extra contact methods to user fields */
    require_if_theme_supports( 'framework-userpro', trailingslashit( get_template_directory() ) . 'library/inc/functions/framework-userpro.php' );

    I can offload all sorts of extra code to a conditional, right down to CSS and JS enques, that won't ever run unless the child explicitly declares support for them. If I want to take advantage of that code in the child, I can do this in the child theme's functions.php (or in a functionality plugin):

    add_theme_support( 'framework-userpro');

    And just like that, all of my code comes to life. Scripts enqueue, admins appear, etc. Exactly what happens is defined in the framework-userpro.php file, or whatever I've decided to name my feature.

    If I want to get really tricky, I can boot add_theme_support() out to a required library file and surround it in a conditional statement using something like the Redux framework for theme and plugin options:

    global $redux_options;
    if ( $redux_options('extra_contact_methods') {
        add_theme_support( 'framework-userpro');
    }

    And now that entire conditional statement is tied to a switch in the theme's options panel instead of requiring the end user to hand-edit their functions.php file.

    I wish more theme developers worked this way.

    So on the PHP side, using a framework is all about creating shortcuts for yourself so that you can reuse code objects on command, worrying only about how to style them in the result. The framework that most famously takes this approach to theme development is Hybrid Core, which is really a framework for creating your own parent framework, and not a theme at all.

    2. The CSS Framework

    What applies to PHP also applies to your stylesheets, especially when you get into the magic of SASS/SCSS and LESS. The big players in this category are Zurb's Foundation 5 and Twitter's Bootstrap 3. Zurb is the more powerful framework but Bootstrap is the more popular one, in no small part becuase it's easier to learn. Twitter uses the more common LESS pre-processor for CSS and a JavaScript compiler. Zurb uses the more powerful SASS/SCSS pre-processor, which will require you to have a local Apache server environment with Ruby on Rails, and a decent grip on command line features if you really want to take advantage of it. Don't be put off by that though, since you can always grab a pre-compiled copy here.

    In both cases, what you get is a responsive grid that supports a number of pre-defined CSS and JS functions. You can effectively lay out a scaffolding for a site, then lay your own styles over the top of it.

    I'm a big Foundation guy. I think it creates much more interesting layouts and the CSS classes are much easier to override. The most prolific WordPress theme designer using Foundation is Pirenko. Here's his Gusto theme framework, for reference.

    Which leads me to item #3.

    3. WordPress Frameworks, including the kitchen sink

    In WordPress, Framework gets a much more complex treatment. Products like Builder, Genesis, Thematic, Thesis, and Pagelines are major frameworks. WPMUDev continues to work on a competitor of their own. In WordPress, these days, any parent theme that is designed more for child-theming than direct configuration basically calls itself a framework. That includes popular Themeforest items like The7 and the afforementioned Gusto.

    The quality of these frameworks is wildly variable, and their features range from a quick set of shortcodes to true drag & drop editing.

    For something in the middle, you can use a framework like Roots or Reactor, combined with plugins like WP-Types, Advanced Custom Fields, or Posts-to-Posts to bolt on additional functionality that can be easily exported from one functionality plugin to another.

  • Titanium Creative

    I also use Genesis and the trick for me was to change the way I thought about programming. Genesis add "hooks" to the usual complement provided by WP that allow you to make adjustments to the code by adding and subtracting bits where you need them.

    So, instead of top down programming, the most basic Genesis template will just have:

    genesis();

    in it.

    From there you:

    add_action('hook', function() { Stuff you want to add; });

    or

    remove_action('hook', 'function_to-remove');

    Was a bit strange at first but now I love the simplicity.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.