Support » Theme: .TUBE » Replace Date and Author with Category

Viewing 9 replies - 1 through 9 (of 9 total)
  • Theme Author tubegtld

    (@tubegtld)

    1) For the home/index/archive type pages, you might consider using the “Post List Label Taxonomy” feature, which is kind of buried at the bottom under Customize > Labels & Text Strings

    Just select the “Categories” taxonomy and it’ll include a little label above the title (which I think looks nice).

    Then you can just use CSS to hide the post-meta…

    .list-posts .post-meta { display:none; }

    2) Please stay tuned for a theme update (shortly) that will add new filters to allow you more control over the post-meta area on both home/index/archive and single templates.

    Theme Author tubegtld

    (@tubegtld)

    Okay, new version of the theme (1.1.7) just pushed to the repo and should be available via WP Update soon (or you can grab it here).

    This update includes a handful of new filters in the file /tube/classes/class-tube-post-meta.php that can be used to more fully control the output.

    In your case, I’d suggest using tube_filter_post_meta_parts which is an array of each “part” of the post meta (ie. each item in the array becomes an li tag in the post-meta ul).

    So, if you want JUST the post’s categories as a list, you can do something like this which replaces the existing parts with a single part that has a comma list of the categories….

    add_filter( 'tube_filter_post_meta_parts', 'my_replace_post_meta_parts' ); 
    
    function my_replace_post_meta_parts( $parts ){
      
      return array(
        'categories' => get_the_category_list( ', ' )
      );
      
    }

    Of course you can then replace the return function as you see fit.

    Alternatively, if you want to keep some parts but not others and/or amend the list, you can do that too.

    So for example if you want to remove the author, but keep the date and comment count, and add the categories and a custom message, you could do so like this…

    add_filter( 'tube_filter_post_meta_parts', 'my_modify_post_meta_parts' ); 
    
    function my_modify_post_meta_parts( $parts ){
      
      // remove the author
      unset( $parts['author'] );
    
      // set up the new stuff
      $new_parts = array(
        'categories' => get_the_category_list( ', ' ),
        'message' => 'Hi, mom!',
      );
    
      // merge and return
      return array_merge( $parts, $new_parts );
      
    }

    That’s about it. Please mark as resolved if this does the trick, and if you’re digging the theme please leave a review to help get the word out.

    NOTE: Examples above assume you’ve got a child theme and know how to drop some code into functions.php.

    • This reply was modified 1 year, 1 month ago by  tubegtld.
    • This reply was modified 1 year, 1 month ago by  tubegtld.
    Theme Author tubegtld

    (@tubegtld)

    Hey – Were you able to test this? Did it work?

    Theme Author tubegtld

    (@tubegtld)

    Deleted

    • This reply was modified 11 months, 3 weeks ago by  tubegtld.
    Theme Author tubegtld

    (@tubegtld)

    Marking as resolved due to lack of reply.

    Hello
    .list-posts .post-meta { display:none; }
    is working just on main page. Author on every post is not to hide.

    Theme Author tubegtld

    (@tubegtld)

    Hi @alexeyaleynikov.

    Can you please start a new ticket with a reference link and a bit more detail?

    Thank you.

    I fix it with:

    .post .post-meta { display:none; }

    Theme Author tubegtld

    (@tubegtld)

    Great.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Replace Date and Author with Category’ is closed to new replies.