Genesis Quick Tips

There’s a lot of small code snippets I use often but don’t warrant their own post. This is where I’ll collect them. If you have any quick tips, feel free to share in the comments.

Also check my general code snippets page.

Setup the child theme
As described here, it’s a good idea to create a theme setup function in which you’ll place all the filters, actions, and theme-supported features. This is what I include at the top of my functions.php file in my child themes. Any time below you see an add_action or add_filter, that part goes in the setup function, and the function itself goes after the setup function.

Force a page layout
This is very useful for ensuring custom pages you build for a client aren’t broken by them changing the page layout (ex: home page). Or, changing the page layout to something other than the default on archive pages (ex: category).

Unregister unused page layouts

Structural Wrap
This adds a div with the class of “wrap” in an element. In the code below I’m adding it to #inner for a full-width page layout. More details.

Add Image Sizes
See Mark Jaquith’s postfor details. This adds an image size named ‘feature’ with a fixed size of 600×250.

add_image_size('feature', 600, 250, true);

Remove Post Info

remove_action('genesis_before_post_content', 'genesis_post_info');

Modify Post Info
Shortcode Reference

Remove Post Meta

remove_action('genesis_after_post_content', 'genesis_post_meta');

Modify Post Meta

Change Excerpt More text […]

Remove Footer

remove_action('genesis_footer','genesis_do_footer');

Remove Footer and Footer Markup

(thanks Paul de Wouters)

Customize the Search Form text

Customize the Search Button text

Remove Breadcrumbs

remove_action('genesis_before_loop', 'genesis_do_breadcrumbs');

Remove Home from Breadcrumbs
add_filter('genesis_home_crumb', '__return_false');

Customize the Breadcrumb
Full list of arguments here.

Customize the Site Title (in #header)
This is useful if you want to use the default site title (Settings > Title) but style different elements of it differently. This specific code searches for “of” in the site title, and changes it to <em>of</em>.

Remove the Post Title

remove_action('genesis_post_title','genesis_do_post_title');

Display Description of Menu Items
To add a description to a menu item, go to Appearances > Menus. At the top right click “Screen Options”, then check “Description”. Now you can click the dropdown arrow next to menu items and add a description. The below code will make it visible on the site. Here’s another, more detailed approach.

Register a Sidebar

Unregister a Sidebar

unregister_sidebar('sidebar-alt');

Customize Read More Link

CSS – Images scale to content area (useful for Responsive Design)

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. Vincent Browning says

    Hi I am relatively new to WordPress and I am working on a couple of sites at the minute. I was wondering if you could help me out Bill. I am using WordPress with the Genesis Framework and Genesis child theme. My Question is: ”How do I remove the Primary Sidebar from the home page only” I have been looking on the net for help and cannot seem to find anything that works. If you could help me out I would really appreciate it. Thanks

  2. Lorraine Cheney says

    Thanks for a great post Bill, I found this looking for something else but it has extended my Genesis knowledge. Thanks for sharing.

  3. Jon Loomer says

    I’m having a heck of a time with something, and hope you can help. I want to remove all “Filed under” and “Tagged With” copy on the content archive pages. I want to leave that in all of the actual blog posts. How would I do this?

    Thanks!

    • Bill Erickson says

      In functions.php, you’ll need to use the genesis_post_info and genesis_post_meta filters to alter the post info/meta in the way you want. For instance, let’s say you want the categories and tags in the post meta, functioning as you describe: https://gist.github.com/2141539

      For information on the shortcodes and their parameters, see the Genesis Shortcode Reference

  4. Eric Erickson says

    Awesome awesome tips – thank you so much for sharing! Already put a few of these to use.. Nice last name too šŸ™‚ Thanks again!

  5. Justin Tallant says

    Thanks for sharing. I have a Sublime Text 2 package that includes Genesis snippets. You can use tab triggers to generate many of these snippets and others inside Sublime. I’m curious, what editor do you use?

    Sublime Text 2 Genesis Package on Git
    https://github.com/jtallant/Genesis

    • Bill Erickson says

      I use Coda, but I don’t have any built-in snippets. I work across multiple computers (a desktop and two laptops) so keeping code snippets in the program in sync is a nightmare. That’s why I set up code snippets on my site. I just leave that tab open in my browser, and when I need something I search that page for it.

      • James Burgos says

        Hi Bill,

        Is this still your workflow with regards to snippets, and are you still using Coda? If not, would you mind sharing your current environment/workflow?

  6. Dawson says

    Many thanks for posting these useful code snippets. Genesis is such a cool framework with great flexibility, like it.

  7. Dave says

    Bill,
    Your articles are Extremely Helpful. You are THE MAN!! I just wanted to remove both footer AND markup, and voila, here it is!
    Thanks again,
    Dave

  8. Bilal says

    A great collection of snippets, will be using in my future projects. Your tutorials have been really helpful.
    Thanks

      • Craig says

        Thanks for the tips. Actually it’s the Featured Posts widget, and since it’s the only place that displays posts on the site, I was hoping I could change the way ALL post titles are displayed – which I was then hoping would carry over to the Featured Posts widget that uses them. Is something like this possible?

        • Bill Erickson says

          You’ll have to rebuild the Featured Posts widget. It does not offer the ability to customize the markup of listings.

          • Craig says

            I am trying to unlink my post titles and can not seem to find a solution. Any help would be greatly appreciated. I also appreciate all the great advice I have received from your endless contributions.

            • Bill Erickson says

              Add this to your functions.php file:

              add_filter( 'genesis_link_post_title', '__return_false' );