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. Kumar Sekhar says

    How can we add “href anchor link” to logo in any “genesis child theme”?

    Thanks,
    Kumar Sekhar

    • Bill Erickson says

      I’m not sure what you mean. The title is already wrapped in an anchor link, you just have to set the background image of that anchor link to be your logo.

  2. Cor van Noorloos says

    Hello Bill,

    It seems when using the menu descriptions snippet, it’s somehow affecting more then just the menu and menu widget.
    In example it’s also affecting

    function lorem() {
    echo ‘lorem’;
    }
    add_action(‘genesis_after_header’, ‘lorem’, 15);

    making ‘lorem’ a link

  3. Mark Howe says

    Bill,
    Thanks for sharing all of these code snippets. Glad I finally found this page. This is why I love the Genesis community.
    Mark

  4. Anand Kumar says

    Hello Bill,

    I want to remove the title from breadcrumb. How can i do that.

    e.g.
    Blog » Tutorial » Genesis Quick Tips

    should look like this:
    Blog » Tutorial

    I hope their will be any solution!!

    • Bill Erickson says

      They belong in your theme’s functions.php file. But make sure you know what you’re doing. If you’re not careful it is easy to break the site. Also make sure you do not do this through the theme editor built into WordPress. If you paste something wrong your site will go down and you can’t access the backend.

      • David Trees says

        So does that mean that adding these codes is down… Via… ;! … Only FTP into your sites theme folder?

        OK you guessed it, I’m an ultra newbie… It’s out now LoL

        Are there any videos that are of a standard you would recommend Bill?

        We all got to start somewhere with Genesis. Oh that’s right Genesis means beginning. Thanks for any ultra newbie tips or video suggestions.

        I’ve seen quite a few on the studio press site.

  5. Cathy Tibbles says

    I dont understand the “Force Page Layout” above, Bill… how does that apply to categories only? Wouldn’t that apply to everything? and what does the underscore before the option mean?

    • Bill Erickson says

      Yes, if you put it in functions.php it would apply to all pages, but if you put it in category.php then it applies only to the category archives, and in front-page.php only on the front page.

      When using Genesis, think of each template file as a functions.php that applies to a subset of your pages.

  6. Dmitry says

    Hi. How do I exclude Homepage from showing breadcrumbs and still be able to show them on blog page?
    Thanks!

  7. Chris says

    Hi Bill,

    Thanks for all of these extremely useful snippets.

    Regarding the ‘Remove Post Title’ snippet:
    From everything I’ve read about SEO, the title tag is one of several important on page SEO factors.
    So, at first I was worried about removing the titles – though I wanted to for appearance sake.

    Howver, I noticed that when I use your snippet to remove the title, the Title tag is still intact in the page source, with the correct page title.

    Do you know if using the ‘Remove the Post Title’ function adversely affects SEO?
    Or, in your opinion does this method give us the best of both – no unsightly titles without forfeiting that SEO factor?

    Kind Regards.

    • Bill Erickson says

      You’ll lose the h1 on the page, so that will affect your SEO. I only recommend using this if you plan to manually type in an h1 in the post content.