WordPress.org

Forums

[resolved] Hiding date and author info for certain categories only Plugin (9 posts)

  1. STheos
    Member
    Posted 1 year ago #

    Hi, I found how to do hide the date and author info for certain categories only in previous forum posts, but since i have no clue on PHP and i am afraid that I am going to break something, is there a plugin for this?

    Cheers

  2. Design Locker
    Member
    Posted 1 year ago #

    Can you post a link showing a page with the page and author info you would like to hide please?

  3. STheos
    Member
    Posted 1 year ago #

    Here's the link, http://www.laymanswiki.com/

    we are currently adding the content but we have some content from authors that we want to add to a new category, we want to show their name on this category.

    Nothing has been published yet. the category is
    http://www.laymanswiki.com/category/laymans-corner
    we want to show their names when they post to this category.

  4. Alit
    Member
    Posted 1 year ago #

    you can hide the author, date via css without touching php or using a plugin, you can hide for specific categories too.

  5. STheos
    Member
    Posted 1 year ago #

    Thank you. how do i do that?

    If I go display: none; it will hide the author from all categories.

  6. Alit
    Member
    Posted 1 year ago #

    WordPress doesn't add category name to the single post, to do that we need this simple function, add it to ur functions.php (clearly was wrong when i said no php)

    function add_category_name($classes = '') {
       if(is_single()) {
          $category = get_the_category();
          $classes[] = 'category-'.$category[0]->slug;
       }
       return $classes;
    }
    add_filter('body_class','add_category_name');

    http://bavotasan.com/2011/add-a-posts-category-name-to-body-class-in-wordpress/

    and then:

    body.category-catname .entry-date,
    body.category-catname .td-category {
     display: none;
    }
  7. STheos
    Member
    Posted 1 year ago #

    Thanks Lynnais.

    I am not a guru but wouldn't this add and remove the category name and not the author?

    I will try it and will let you know.

  8. Design Locker
    Member
    Posted 1 year ago #

    Try display: none on only the categories you want the author removed on;

    .category-id-123 .author, .category-id-456 .author {display: none;}

    Change 123 and 456 etc above to the category you want to hide the author for and change .author to what ever css rule governs the display of the author.

    Ir will then show author all all categories except the categories you entered above.

  9. STheos
    Member
    Posted 1 year ago #

    That's great mate!

    It seems to do the job.

    Thanks a lot.

Topic Closed

This topic has been closed to new replies.

About this Topic