Designs By Nick the Geek

Genesis Based WordPress Development and Tutorials for Everyone

  • Email
  • GitHub
  • Twitter
  • Home
  • About
    • My Experience As…
    • Bedtime Stories by Me
  • Themes
  • Genesis Explained
    • Actions
    • Filters
    • Functions
    • Admin
  • Plugins
  • Themes
    • Free
      • Fluid
  • Tutorials
    • Quick Tips
nickthegeek January 2, 2012

Skip Terms

skipping terms is easyBack when I first started my personal blog, I was using a theme with a custom home page and no blog page template. This posed a problem as I didn’t have a good archive for all of my posts, so I setup a default category “All” that every post was added to. This worked pretty good for that theme, but presented problems for me in Genesis.

Specifically, the breadcrumb showed this “all” category instead of the primary category for my posts. I wrote this simple work around to hide the this category from my breadcrumb

add_action( 'genesis_before_loop', 'child_skip_terms', 5 );

/** Starts Skipping Terms Before BreadCrumb */
function child_skip_terms() {
    add_filter( 'get_the_terms', 'child_do_skip_terms' );
}

add_action( 'genesis_loop', 'child_stop_skip_terms', 5 );

/** Stop Skipping Terms After BreadCrumb */
function child_stop_skip_terms() {
    remove_filter( 'get_the_terms', 'child_do_skip_terms' );
}

/**
 * Skips Terms from get_the_terms based on termID.
 *
 * @author Nick_theGeek
 * @url https://designsbynickthegeek.com/tutorials/skip-terms
 * @param array $terms
 * @return array
 */
function child_do_skip_terms( $terms ) {

    $skipterms = array( 3 ); //supply comma separated value of term IDs like array( 3, 56, 79 ), this will work for any term regardless of taxonomy.

    foreach ( $skipterms as $skip ) {

        unset( $terms[$skip] );
    }

    return $terms;
}

This particular usage lets my “all” category show in the Post Meta, just not the Breadcrumb. That suits my needs, but a very simple change will hide the term from the Post Meta as well. Change this line

add_action( 'genesis_loop', 'child_stop_skip_terms', 5 );

to

add_action( 'genesis_after_loop', 'child_stop_skip_terms' );

If you liked this article, tell someone about it

Previous Article

add tweet button to your menuAdd Twitter Button to Menu

Next Article

Control Post Order With Genesis Featured Widget Amplified plugin

Related Posts

  • Genesis Responsive Header Updated
  • Genesis Responsive Header
  • How I Make Custom Fields Easier in Genesis
  • How I Added Custom Fields to the Genesis Responsive Slider
  • A Better Home Page

Filed Under: Tutorials Tagged: GenesisWP, Quick Tips

Copyright © 2025 Nick the Geek ·Built on the Genesis Theme Framework using the Streamline 2.0 theme · Log in

 

Loading Comments...