10 Ways to Customise Your Genesis Functions File

Below is a selection of 10 functions you can use or change to enhance your WordPress websites if they run on the Genesis Framework by StudioPress.

How to edit your WordPress functions file

You can edit it within the WordPress admin area by going to Appearance in the left hand menu then selecting the ‘Theme Functions’ file. You can then edit the file in the editor window before saving any changes.

Or you can download it using an FTP client and edit it locally. If you do this you’ll find the functions.php file within your child theme folder location

IE /public_html/wp-content/themes/YOUR-CHILD-THEME/functions.php

Editing your Genesis functions

Below is what to do in order to edit each function. If you have any problems let us know in the comments.

1. Change the default search field text

search this website

This text appears inside the search box when you add the search widget to your site using Genesis theme settings:

enable search this website

Just change the highlighted content below and replace with your own preferred text:

    function search_text(){ 
    return "<span class="highlight">Search The Website</span>";
    }
    add_filter("genesis_search_text", "search_text");

2. Hide the secondary navigation menu controls

secondary navigation menu

If you are not using a sub menu or ‘secondary navigation menu’ on your website you may wish to just remove the drop down selector for it instead of telling your client or colleagues to not touch it!

Typically you can populate a sub menu under “appearance > menus”. If someone chooses a secondary menu your theme is likely to try and display it.

To remove it simply add this code to your functions file:

    remove_theme_support( 'genesis-menus' );
    add_theme_support( 'genesis-menus', array( 'primary' => 
                       __( 'Primary Navigation Menu', 'genesis' ) ) );

3. Remove Superfish Scripts

Save valuable resources when rendering pages which do not have the “enable fancy dropdowns” option enabled for the menus.

    function unregister_superfish() {
        wp_deregister_script( 'superfish' );
        wp_deregister_script( 'superfish-args' );
    }
    add_action( 'wp_enqueue_scripts', 'unregister_superfish' );

4. Change the leave a comment title

Fed up commanding users to “speak your mind”?

Just change the highlighted text below for your own preferred text. Other items related to the comment form can be changed in this filter too.

    function comment_title($args) { 
        $args["title_reply"] = "<span class="highlight">Leave a comment</span>";
        return $args; 
    }
    add_filter( 'genesis_comment_form_args', 'comment_title' );

5. Move the breadcrumbs outside the content sidebar wrap

breadcrumb trail

Handy for when you want to show the breadcrumbs spanning both the main content and the sidebar, rather than just within the main content area.

    remove_action('genesis_before_loop', 'genesis_do_breadcrumbs')
    add_action('genesis_before_content_sidebar_wrap', 
               'genesis_do_breadcrumbs',5);

6. Change the breadcrumb labels

breadcrumb trail

Useful for changing the breadcrumb separator amongst other things, do a full print_r of the argument to find all the available items to change.

    function custom_breadcrumb_args($a) {
        $a['sep'] = '<span class="highlight"> &lt;span&gt;/&lt;/span&gt; </span>';
        return $a;
    }
    add_filter('genesis_breadcrumb_args', 'custom_breadcrumb_args');

7. Remove deprecated menu pages widget

As well as other Genesis widgets and Default widgets, Genesis adds a menu page widget which has been labelled as deprecated. Remove it and save milliseconds of processing time. Below is a full list for removal, simply remove the ones you want to keep from the list.

    function m_widgets(){
        unregister_widget( 'Genesis_eNews_Updates' );
	unregister_widget( 'Genesis_Featured_Page' );
	unregister_widget( 'Genesis_Featured_Post' );
	unregister_widget( 'Genesis_Latest_Tweets_Widget' );
	unregister_widget( 'Genesis_Widget_Menu_Categories' );
	unregister_widget( 'Genesis_Menu_Pages_Widget' );
	unregister_widget( 'Genesis_User_Profile_Widget' );
	unregister_widget( 'WP_Widget_Pages' ); 	
	unregister_widget( 'WP_Widget_Links' );
	unregister_widget( 'WP_Widget_Search' );
	unregister_widget( 'WP_Widget_Archives' );
	unregister_widget( 'WP_Widget_Meta' );
	unregister_widget( 'WP_Widget_Calendar' );
	unregister_widget( 'WP_Widget_Text' );
	unregister_widget( 'WP_Widget_Categories' );
	unregister_widget( 'WP_Widget_Recent_Posts' );
	unregister_widget( 'WP_Widget_Recent_Comments' );
	unregister_widget( 'WP_Widget_RSS' );
	unregister_widget( 'WP_Widget_Tag_Cloud' );
	unregister_widget( 'WP_Nav_Menu_Widget' );
	unregister_widget( 'Akismet_Widget' );
    }
    add_action( "widgets_init", "m_widgets" );

8. Easily add some footer widgets

footer widgets

Above the #footer div, you will need to provide the styling, but the function handles the widget area creation and output.

    add_theme_support( 'genesis-footer-widgets', 3 );

9. Remove layout options

default layouts

If default layouts are being presented in the admin area which are not suitable to use you can remove it completely rather than telling the client not to use it.

    genesis_unregister_layout( 'content-sidebar-sidebar' );
    genesis_unregister_layout( 'sidebar-sidebar-content' );
    genesis_unregister_layout( 'sidebar-content-sidebar' );
    genesis_unregister_layout(‘content-sidebar' );
    genesis_unregister_layout( 'sidebar-content’);
    genesis_unregister_layout(‘full-width-content’);

10. Genesis featured posts get content limit 0 remove the ellipsis

This is useful if you want to display a list of featured posts but only including a title and a read more link.

If you set the content to “show content limit” and set the limit to 0 then by default “…” will show up.

This function returns an empty string instead;

    function alter_content_limit($args){
	if(stripos($args, "…") === 0){
		return "";
	}
	else{
		return $args;	
	}
    }
    add_filter("get_the_content_more_link", "alter_content_limit");

 

And that’s it. Hopefully at least of one these will help you out on a web design project.

Got your own to add? Leave it in the comments :)

Comments

  1. Robin Bennett says:

    I tried #10 to remove the ellipsis on this page http://modpodgerocksblog.com but it doesn’t work.

    I added your code

    function alter_content_limit($args){
    if(stripos($args, “…”) === 0){
    return “”;
    }
    else{
    return $args;
    }
    }
    add_filter(“get_the_content_more_link”, “alter_content_limit”);

    first to the functions.php page and that didn’t work so I added it to the home.php page and it still shows the ellipsis on the first featured post on the HOME page.

    Thanks

  2. Ige Orhionkpaibima says:

    Tried to remove the search field ,but not working,and wanted to ask also if there is any way i can increase the width of the primary sidebar

  3. This one is great round up I have unregistered superfish script, unused widgets and layouts.. I can notice some change in speed (although its milliseconds)

Leave a comment

*

What Our Clients Say

James AgateJames Agate
Managing Director
Skyrocket SEO

Chris and his team (particularly Jamie) are patient, responsive and have a sense of humour even when I asked them to change something that I'd insisted upon initially. Would definitely recommend to anyone looking for an awesome WordPress development and design team.

Richard SedleyRichard Sedley
Director
Seren

Hit Reach were really easy to deal with and provide exemplary service. They implemented exactly what we wanted and guided us when we were uncertain about the solution. A highly professional and cost effective solution – what's not to love.

Roger GreenRoger Green
Director
Best4tyres.com

Hit Reach got it absolutely right. They embraced the challenge and complexity of the site, and exceeded expectation with quick response times and great service.

Our Key Services