Introducing Beans: A Streamlined WordPress Framework

By James George

This article was sponsored by Beans. Thank you for supporting the sponsors who make SitePoint possible.

If you develop websites and themes using WordPress, then you understand how much work it takes. Working from scratch makes you feel like you’re trying to reinvent the wheel, so many developers use frameworks to speed up the process. Finding the right framework means a much easier development process.

This article will outline a new framework for developing WordPress sites, called Beans, and show how it’s useful for creating WordPress sites without hassle.

Introducing Beans

Beans is a starter theme/framework which allows you to pick and choose the features you’ll need to build your website, and trim away the parts you can do without. It’s lightweight and fast, while giving you a lot of flexibility.

Beans makes content responsive and images adaptive, creating multiple versions of images automatically and serving up the right image for the device it’s being viewed on. The content responds to the device as well, restructuring and reorganizing to best fit the device’s display.

Let’s take a closer look at a few aspects of the framework, before comparing it with its closest competitor, Genesis (which I’ve covered myself on SitePoint).


Beans is built to be SEO-friendly. Other themes and frameworks out there aren’t semantic, and they aren’t built with SEO in mind. Beans is built to be descriptive and semantic, making it optimized for search engines. You don’t have to worry about whether your content meets the requirements for search engine indexing, it’s built right into the framework. Beans is lightweight and optimized for mobile — two features that are vital for SEO success.

Child Themes

Beans uses and recommends using child themes to build custom sites. This means that when Beans is updated, your site doesn’t break. The Beans team also provides a basic child theme to help you to get started.

Site Design

With Beans you can control the structure of each page globally or individually. You can set the layout of the site in the customize section of the WordPress admin. You can also control the layout on a per-page basis. You have the choice of one left or right sidebar, two left or right sidebars, one sidebar on both sides, or no sidebar at all.


Beans makes it easy to keep your code looking clean and organized. If you find yourself writing too much code for a specific page, you can take all of it and place it into a page template for that page. This keeps you from having to sort through a jumbled mess of code in your functions.php file. You can place specific code on highly customized pages.

Even the CSS is easy to update and maintain. You can use Less, or you can use CSS. Everything is kept in the style.css file located in your child theme. This keeps you from having to dig through the main CSS file to find the line you’re looking for. You simply add the CSS to override how something looks or how it is structured.


One of the reasons for Beans’ emphasis on creating child themes is so that when Beans updates their core theme, your site won’t become broken. You may have to update a line of code in your child theme, but it’s still better than ending up with a broken site.

Now let’s take a look at how Beans compares to Genesis, its closest competitor.

Beans Vs. Genesis

The first obvious question when considering Beans is, how does its approach compare with Genesis? I installed Beans and set up a site to compare how it runs against a Genesis-based site.


Genesis themes all tend to have a similar look. This depends a lot on the developer, but a lot of Genesis sites look similar in appearance and structure. Beans offers the flexibility to create whatever you can imagine. With UIkit integration, you get access to all sorts of components to create a modern, custom website for yourself or clients. UIkit itself can be customized to look how you want, making it easy to work with and easy to create a custom look.

Page Weight

Beans also builds more lightweight sites than Genesis, as you only call into your site what you need. You don’t use scripts and components you don’t need, and you aren’t loading scripts for those items.


In Beans, you can remove and show elements on a per-page basis, which makes it quick and easy to customize. This is as simple as one line of code in your functions.php file.

You also have much more flexibility and control over a site’s HTML. You only load the markup you need. You can use UIkit HTML attributes to style and layout pages. The big difference with building Beans WordPress sites is that you have hooks before and after each bit of HTML markup. You can add content easily, enabling you to shift elements around as needed.


Beans is faster overall. There are a couple of reasons why. The first reason is that all assets are combined into one file. Also, on a per-page basis, you only load what you need. That means you aren’t loading markup on pages that isn’t necessary. All of this is controlled with Beans.

The other reason Beans is faster is because you can build fairly complicated sites without being dependent on implementing a lot of resource-devouring plugins to add functionality. When combined with the fact that Beans only loads what the page needs and nothing extra, it makes it a lean and lightning-fast solution for any WordPress developer.

UIkit Integration

UIkit is an open source front-end framework built into Beans, designed to help you build gorgeous sites without bloat. You load only what is needed on a per-page basis, meaning you aren’t loading scripts and components you aren’t using. This makes your site attractive and lightning fast.

I made this its own section, because it is a big one for me. The integration of UIkit enables you to create any type of layout you want. All you need is the right CSS class to apply to an element, such as a div, and it will control the structure of the page. It makes it easy to build with, because it is similar to frameworks that a lot of developers already know, such as Bootstrap. You can load components on the fly, but only when you need them.

UIkit integration allows you to add classes for things like alignment, without having to write special CSS for it each time. For example, on the About page, I wanted to center the title. Instead of writing a block of CSS for a special title class, I was able to add a utility class to get this done. I used:

<h1 class="uk-text-center">About</h1>

Classes like these can be added on top of other Beans classes, making it easy to get the layout you want without having to write block after block of code.

Fields API

Another standout feature Beans has implemented is the Fields API. Right now, WordPress doesn’t have a fields API. If you’ve ever tried to build, organize or change the content in the backend, it can be a real chore to accomplish this. The Fields API offers a range of fields that can be used in the WordPress backend. If you’re building a completely custom WordPress site, you will likely want to add back-end options and fields for website specific information.

You can create options fields, post meta fields and customizer fields. These are all popular features that WordPress users look for when using a quality theme. The different field types you can implement are:

Text – Place a single word here.
Text Area – You would place a paragraph of text here.
Select – Select an available option.
Checkbox – A checkbox that would enable a feature.
Radio – A text or image based radio list.
Image – Enable a single image or a gallery of images.
Slider – A slider hat allows you to choose a specific value in a range.
Group – A group of fields.

To implement Fields, you will use the admin_init for all 4 field types. You can set the field id and label. You can display those values on the front end using beans_get_post_meta, or the other closely related hooks. This gives you the ability to display any information you want, however you like, within your theme.

The Customizer

More and more WordPress users are expecting to see the Customizer come into play when selecting options. The Customizer displays a live front end view of the site while you manipulate values in the back-end. The Customizer is really just a stacked set of theme options displayed while you view the live site. This keeps you from having to save the back-end and come back and revise your choices. The Fields API allows you to completely control the customizer from the front end.

Free and Open Source

Beans is 100% free and open source. There are other frameworks out there that are lacking in features, but you still end up paying for those. On top of the documentation, they provide helpful code snippets and code references to help you along the way.


Beans is also well-documented, with examples for each component, showing you how to implement each feature. You begin with a good starting point, and from there, the sky is the limit to what you can build.

Now we’ve taken a look at how Beans compares to Genesis, let’s take a closer look at working with the framework.

Getting Started

Getting started with Beans couldn’t be easier. First, visit the Beans website and download and install the Beans framework. Then, you’ll want to go to the “Child Theme” section of their website and download the child theme. Go back to the WordPress dashboard and install the child theme after making sure the base framework is installed. You must download the base theme and install it before installing the child theme.

Before You Start Building

You’ll want to dig into the documentation to familiarize yourself with how the framework works. There are a couple of things you will want to review and refer to as you work.

UIkit API – This is the set of components integrated within the theme itself. You have a vast amount of customization options, which offers a lot of flexibility.

Understand How Child Themes and File Structures Work – You’ll need to have a basic working knowledge of how themes and child themes work, including what each file is and it’s purpose. This will help you to understand how to modify your theme. This SitePoint screencast outlines the basic process of creating a child theme.

Beans HTML API – This allows you to easily modify page layouts. You can modify the markup just how you need to create a truly custom structure for your theme.

Now to Really Get Started

Navigate to Admin > Appearance > Settings to set the options for the Beans framework. While you’re building your site, you’ll want to enable development mode if you are using Less. There are other options here, such as the ability to flush images and cached scripts, but we will leave those alone for now.

You can either use Less to overwrite UIKit variables or edit the CSS directly. Whichever method you choose, you’ll want to enable or disable the alternative method in the functions.php file of your child theme. All new functions will be added here.

In my example, I am going to use CSS, so I’ll remove the following block of code from the functions.php file:

* Remove this action and callback function if you do not wish to use Less to style your site or overwrite UIkit variables.
* If you are using Less, make sure to enable development mode via the Admin->Appearance->Settings option. Less will then be processed on the fly.
add_action( 'beans_uikit_enqueue_scripts', 'beans_child_enqueue_uikit_assets' );
function beans_child_enqueue_uikit_assets() {
   beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/style.less', 'less' );

How Designing Your Site Works

Beans makes things easy when it comes to page customization. You don’t have to add scripts to pages and bloat your site. You can add components to pages using a mix of functions and the UIkit structure system to build the layout.

Design Layout

In the image above, you can see the typical site design you start out with. This is the default look you would expect with just about any starter theme. However, customizations are applied via the functions.php file, which allows you to do some pretty interesting things. If I add the following code, the layout changes, with the site going into grid mode.

// Enqueue the UIkit dynamic grid component.
add_action( 'beans_uikit_enqueue_scripts', 'beans_child_enqueue_grid_uikit_assets' );

function beans_child_enqueue_grid_uikit_assets() {

	// Stop here if we are on a singular view.
	if ( is_singular() )

    beans_uikit_enqueue_components( array( 'grid' ), 'add-ons' );


// Display posts in a responsive dynamic grid.
add_action( 'wp', 'beans_child_posts_grid' );

function beans_child_posts_grid() {

	// Stop here if we are on a singular view.
	if ( is_singular() )

	// Add grid.
	beans_wrap_inner_markup( 'beans_content', 'beans_child_posts_grid', 'div', array(
		'data-uk-grid' => '{gutter: 20}'
	) );
	beans_wrap_markup( 'beans_post', 'beans_child_post_grid_column', 'div', array(
		'class' => 'uk-width-large-1-3 uk-width-medium-1-2'
	) );

	// Move the posts pagination after the new grid markup.
	beans_modify_action_hook( 'beans_posts_pagination', 'beans_child_posts_grid_after_markup' );


You can see what it looks like in the screenshot below:

Responsive dynamic grid

You can see from the screenshot that it doesn’t look so pretty at the moment, but you can change the way the layout is structured from within the functions.php file. You can also take away and reorder elements. I don’t like the order of content inside the post. Currently the title is first, followed by the meta, and then the image. I want the image to be the first thing, because readers generally respond more to visual stimuli. All I have to do in order to change this is add the following code to my functions.php file.

// Move the post image above the post title.
beans_modify_action_hook( 'beans_post_image', 'beans_post_title_before_markup' );

Move post image above post title

As you can see from the screenshot, this little bit of code immediately moved the post image above everything. I also feel like the grid layout doesn’t have room for all of the extended information, so I am going to remove the meta information and categories. You do this by placing the following code in functions.php:

// Remove the post meta categories.
beans_remove_action( 'beans_post_meta_categories' );
// Remove the post meta.
beans_remove_action( 'beans_post_meta' );

Customizing the Design

Adding design elements to your site is simple. If you want something to only show on a specific page, you’ll create your own function. I added a cover image to the child theme’s home page. I created the following function:

add_action( 'beans_header_after_markup', 'beans_child_home_add_cover' );
function beans_child_home_add_cover() {
	// Only apply to home page.
	if ( !is_home() )
	<div class="uk-cover-background uk-position-relative">
		<img src="http://designpile.net/wp-content/uploads/2015/10/mountains-863474_1920-e1445350970446.jpg" width="" height="" alt="welcome mountains">

The code above looks daunting until you break it down. First, you’re adding an action, just like you would on any other functions.php file. Then, you’re specifying that after the header markup, you want to create a function that adds a cover image to the home page.

Next, you’re telling Beans what that function is. You’ll specify that it only applies to the home page. This basically checks to see if the current page is the home page, and if it is, that you want to add a responsive cover image.

The divs with ‘uk’ classes applied to them are specific to the UIkit integration, which you can find in the documentation section or on the UIkit website.

Once you refresh the page, you can see from the screenshot below that the cover image has been placed on the home page, just after the header markup. This places it before the post content and the sidebar. You’ll create a function like the one above for each section of any custom page you create.

Homepage cover image

Excessive Customizations

One thing you’ll want to do is take note of creating a lot of customizations per page. If you realize that you are adding a lot of customizations, such as a custom layout, added features, etc., you’ll be better off creating a page template. You create a page template like you normally would, using a named template tag, but you’ll also need to add the Beans specific code. The example code below shows adding two columns of text on the about page.

/* Template Name: About */ ?>
add_action( 'beans_header_after_markup', 'beans_child_view_add_title' );
function beans_child_view_add_title() {
   <div class="uk-container uk-container-center">
        <h1 class="uk-text-center">About</h1>
add_action( 'beans_content_prepend_markup', 'beans_child_view_add_layout' );
function beans_child_view_add_layout() {
    ?><div class="uk-container uk-block">
	<div class="uk-width-medium-1-2">
       <h2>Our History</h2><p>No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. But who has any right to find fault with a man who chooses to enjoy a pleasure.</p>
	<div class="uk-width-medium-1-2">
       <h2>Our Mission</h2><p>To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p>
// When using page template, it is very important to load the document after the customizations.

Excessive customizations

Notice the integration of UIkit markup. This is how you build the structure of your site. Doing it the way I show above is okay for a limited basis, but if you are pulling in large amounts of content, such as an array of posts, you’ll want to use the hooks that Beans provides in its documentation.

Beans’ hooks allow you to tie into the WordPress structure wherever you specify. For example, the sample code:

do_action ( 'beans_after_posts_loop' )

initiates your command after the lists of posts that are displayed. Something you might place here would be pagination. If you wanted to add breadcrumbs, you might use:

do_action ( 'beans_before_posts_loop' )


It may take you a short time to familiarize yourself with the Beans framework, but once you do, you’ll be able to create a highly customized website in a fraction of the time you normally would. You can develop custom layouts for every page, while keeping the entire site lightweight.

When compared with the Genesis framework, you can do anything with Beans that you can do with Genesis, but you have a lot more options for structure, design, and customization without having to sift through existing code or the need of other plugins.

Interested? Head here to get started with Beans today.

  • Chris Rault

    Great write-up James! I’m a bit bias (being that I was on the ground-floor at Beans conception), but once you get started, it’s really addictive! The absolute control over what gets outputted, combined with
    the awesome library of UIkit components enables you to pretty much implement even the craziest designs.

    I’m a big fan of designing out-the-box and I have yet to come across a scenario where Beans wasn’t
    able to accommodate. See ThemeButler.com for an example of the latest free child-theme I’m working on. It’s quite a bit different from the other simple child-themes that are available on the site and takes
    advantage of many of the UIkit components (along with Jetpack and WooCommerce support).

    Most of all, I’m excited to see what people build with Beans!

    • http://designcrawl.com Design Crawl

      Thanks Chris! I will have to check out that child theme! I have been playing around with it myself, and hope to build the core of some cool WordPress themes with Beans. I am really interested in the Fields API and what can be done with that.

    • http://designcrawl.com Design Crawl

      Thanks Chris! I will have to check out that child theme! I have been playing around with it myself, and hope to build the core of some cool WordPress themes with Beans. I am really interested in the Fields API and what can be done with that.

  • http://designcrawl.com Design Crawl

    I’ve played around with Roots. I haven’t looked at it since the name change to Sage. I may revisit Sage in the near future. You can never have too many tools under your belt!

  • http://designcrawl.com Design Crawl

    I’ve played around with Roots. I haven’t looked at it since the name change to Sage. I may revisit Sage in the near future. You can never have too many tools under your belt!

  • http://www.simondowdles.com Simon Dowdles

    I can honestly say, that after using beans as my framework of choice to roll out changes across a whole fleet of corporate web sites that require a maximum degree of customization controls, Beans wins hands down. When you start to dig beneath the hood of the beans vehicle and truly start to understand all the customization options, you’ll never look back.

    I say this with 100% confidence: Beans is quite possibly the best thing to enter my WordPress world in the 6 years that I have been using WordPress.

  • http://www.cygnet-infotech.com/ Hemang Rindani

    Consistency is the key to make any website successful. With time, many developers work on the website each having their different style of coding and maintaining the webpage, this makes it tough for the organization to maintain the consistency. Framework helps to create a design that any developer can play with and still provides a consistent look. WordPress supports various frameworks that speeds up the CMS development process. From Thesis to Genesis and now Beans, it has enhanced the website development process by providing better features and secured database connections.

  • Daniel Brown

    Another WordPress framework. I think this one will give genesis, gantry , templatetoaster and themler a stiff competition .

  • Pavan Nadella

    competition for Gensis? are you kidding….FYI not working with XAMPP on win 10……please don’t compare this with genesis …..its got a long long way to go, I guess its a very bad start….SitePoint I thought you write genuine articles……..you proved me wrong…..It seems now a days, for advertising revenue, you write anything without verifying

    • https://getbeans.io/ Thierry Muller

      Hi Pavan,

      Sorry to hear you had a bad experience using it on XAMPP Win 10. We did push a few release addressing issues on Window XAMPP, mostly due to path and permissions issues. Which version did you try?

      I think your words are a bit harsh considering that you didn’t actually spend time using the framework and didn’t even contact the support when you faced the issue. We are definitely here to help and make sure the framework gets better and better based on user feedback, that is why there is a support section (free by the way).

      Just saying it is bad isn’t really on constructive feedback. Nobody forces you to change the framework you are using. If staying in your comfort zone and not wanting to discover new innovative products which could help you build faster and better, your are completely entitled to do so. That said, I don’t find it very constructive to be a hater and just say the rest is bad without actually having a solid go at it with willingness to learn before judging.

      We are even happy to take one of your site and show you how Beans performs.


      PS: maybe consider that there could be a reason why many devs already love Beans, those who actually spent time using it.

  • Hans

    “This article was sponsored by Beans.” Mmm. James, how can I know if there’s a relationship between your enthousiasm for Beans and this sponsorship? BTW, apart from that, very informative and well-written article.

    • http://designcrawl.com Design Crawl

      Hans, thank you for the kind words about my writing. My enthusiasm is genuine. Beans is a great framework that offers a high level of customization. When I look at anything like this, I come at it objectively. My job was to put it through its paces and try to break it, and I couldn’t. It was so open ended and fully customizable, and the fact that you can add parts of it on a per page basis means there is no bloat. A big complaint with a lot of frameworks, is that you have to load everything, or that you have a bunch of stuff that you aren’t using, meaning that you end up creating bloated themes that don’t run as fast as they could. Beans does away with that and enables you to fully streamline your entire theme, JUST how you want.



Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in WordPress, once a week, for free.