• I would like to know how to hide the category title links that show on posts but remove(hide) them on a specific post without hiding them on all posts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Inspect the page and look at the class attribute on the body tag. You will see something like postid-123. That class is unique to just that one post. You can also see the id number by looking at the browser status bar when highlighting Edit on the post in the admin panel or in the address bar when editing the post.

    Set some custom CSS like:
    body.postid-123 .entry-categories { display:none; }

    To also hide it on the blog page:
    body.blog article.post-123 .entry-categories { display:none; }

    Thread Starter Manny

    (@thewebnerd)

    Thanks I already use .postid-123 .entry-categories-inner { display: none; }
    But I will try that for future projects.

    template-parts/entry-header.php

    find:
    if ( true === $show_categories && has_category() ) {

    insert a post ID condition

    // Conditional examples
    $post_id = '11'; //assign post id you are targeting
    $ID = get_the_ID();//assign current post ID
    $ID === $post_id;  //show only if identical
    $ID !== $post_id;  //show if not identical
    $post_id = array( 11, 12, 13 ); //array of post IDs 
    in_array( $ID, $post_id ); //show only in array
    
    // Multiple conditional statement
    if ( true === $show_categories 
      && has_category() 
      && $ID !== $post_id ) {

    You can include category name/term_id/slug, or an array of them to check for in has_category($args) if you are targeting a specific category.

    • This reply was modified 2 years, 9 months ago by backbone. Reason: typo
    • This reply was modified 2 years, 9 months ago by backbone. Reason: typo
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do you hide category link on just one post ?’ is closed to new replies.