About Travis Smith

As a WordPress Enthusiast, Travis writes about his journey in WordPress trying to help other WordPress travelers and enthusiasts with tutorials, explanations, & demonstrations of the things he learns.

Comments

  1. Marco says:

    Hello, nice roundup of CPT Genesis related tutorials.
    I’d like to ask if you have a quick snippet to conditionally replace the post meta in CPTs with their own custom taxonomies; all done via functions.php and not via a custom template.
    Cheers
    Marco

    • wpsmith says:

      Hello Marco,

      Here is some ad hoc code that will help get you started without knowing your taxonomies or your custom post types. To customize the post meta, simply use the following code:

      // Customize the post meta function
      add_filter('genesis_post_meta', 'post_meta_filter');
      function post_meta_filter($post_meta) {
      if (is_post_type('my_cpt')) {
          //get your terms via get_terms( $taxonomies, $args ); $taxonomies can be an array of taxonomies
          //$myterms = get_terms('my_tax', 'orderby=count&hide_empty=0');
          //$output = '<ul>';
          //foreach ($myterms as $myterm) {
              //$output .= '<li>'.$myterm->name.'</li>';
          //}
          //$output .= '</ul>';
          //$post_meta = '<span class="mytax">Filed Under:'.$output.' </span>';
          return $post_meta;
      }}

      For more information, check out the WordPress codex for get_terms.

    • Amin says:

      I don’t know what to do with this code – I have a custom post template and wanted to display the custom taxonomies. This gives a blank putting it either in the template or functions file.

      To customize the post meta, simply use the following code:

      // Customize the post meta function
      add_filter(‘genesis_post_meta’, ‘post_meta_filter’);
      function post_meta_filter($post_meta) {
      if (!is_page()) {
      $post_meta = ‘Filed Under: ‘;
      return $post_meta;
      }}

  2. vodkarusskaya says:

    I was trying to remove the post meta and the post info for hours until i saw this thread. Travis Smith – god bless you!

Speak Your Mind

*