Genesis: Remove/Change post info/post meta

// Remove post meta
remove_action('genesis_after_post_content', 'genesis_post_meta');
// Customize the post meta function
add_filter('genesis_post_meta', 'post_meta_filter');
function post_meta_filter($post_meta) {
if (!is_page()) {
    // Spaces are added to [ shortcodes ] for display. Do not include.
    $post_meta = 'Filed Under: [ post_categories ], Tagged: [ post_tags ]';
    return $post_meta;
}}
// Remove the post info function
remove_action('genesis_before_post_content', 'genesis_post_info');
// Customize the post info function
add_filter('genesis_post_info', 'post_info_filter');
function post_info_filter($post_info) {
if (!is_page()) {
    // Spaces are added to [ shortcodes ] for display. Do not include.
    $post_info = '[ post_date ] by [ post_author_posts_link ] at [ post_time ] [ post_comments ] [ post_edit ]';
    return $post_info;
}}

Please note that you do not need to remove the functions before editing them. Hat tip to jim đŸ™‚

14 thoughts on “Genesis: Remove/Change post info/post meta”

  1. You should make a note that it’s not necessary to remove a function, then edit it.

    Most people are going to want to remove OR edit, but probably not both. It’s a little unclear that you don’t have to remove to edit.

    Reply
  2. Good point. Thanks Jim. I was trying to show how to remove or edit as separate actions but I can see where it could be confusing . I will make a note.

    Reply
    • You could do something like this:

      add_action('genesis_before', 'remove_cpt_meta');

      function remove_cpt_meta() {
      $post_type = get_query_var('post_type');
      if( !empty( $post_type ) && ( $post_type != 'post' ) ) {
      remove_action('genesis_after_post_content', 'genesis_post_meta');
      }
      }

      Reply
      • Hey Lori,
        Thanks for the reply. That snippet didn’t work for me, but this did.
        add_action(‘genesis_before’, ‘remove_cpt_meta’);

        function remove_cpt_meta() {

        if( is_single && ! is_single(‘post’) ) {
        remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
        }

        }

        I then added another bit of code to remove post info as well:
        add_action(‘genesis_before’, ‘remove_cpt_info’);

        function remove_cpt_info() {

        if( is_single && ! is_single(‘post’) ) {
        remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
        }

        }
        Now I just need a better way to write both pieces of code so that they are more efficient. I’m not a great coder by any measure, so, yeah. =)

        Thanks for the help!

        Reply
  3. Hi Alex,

    Glad you got it working đŸ™‚ Didn’t notice that you were only trying to remove the meta from single posts.

    For efficiency, you can do this:

    if( is_single && ! is_single(‘post’) ) {
    remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
    remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
    }

    I haven’t tested it, but I don’t see any reason why it would not work.

    Reply
  4. Fabulous!! Thank you for your helpful information! Every since Genesis took away the old forum, it has been so difficult to find the answers I need! Thanks so much!

    Reply
  5. Hi Tiffany,

    You should put the code in your child theme’s functions.php file. The code below will show only the categories with no labels or tag info:

    /** Show post categories */
    add_filter( 'genesis_post_meta', 'post_meta_filter' );
    function post_meta_filter($post_meta) {
    $post_meta = '[post_categories before=""]';
    return $post_meta;
    }

    Reply

Leave a Reply to Tiffany Cancel reply