Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:45:36+00:00 2026-06-16T13:45:36+00:00

Long title, I know :) But anyways, what I’m trying to do is hide

  • 0

Long title, I know 🙂 But anyways, what I’m trying to do is hide a post from its respective category. So say I submit a post and file it under the news category, I want it to not show up in its respective category page, if need be. Weird request, I know..

The way I have went about doing this is creating a custom field called “hide” with any value, then I echo the CSS style for the div class “post” to display:none. Here is the PHP if statement:

<?php } if($hide) { ?>

echo '<style type="text/css"> .post {display:none;} </style>';

<?php } ?>

This successfully hides the div “post” when any value for the custom field “hide” is entered, but the problem is… it hides all my posts!! Because all my posts are being displayed under the div class “post” and the echoed css style is being applied to all the .post divs and not just the one I entered the custom field for.

Looking at my WordPress posts, each post has a seperate number and div value. Theoretically, I could manually type in the id for each div and hide each post once each post is entered, but that would take way too long.

At this point, I honestly have no idea how to fix this issue so it hides only the post that I enter the custom field for. Any help would truely be appreciated! 🙂

Update: I forgot to mention that I’m also using other custom fields to display the post.. here is how my full php code looks:

<?php } if (is_category('audio')) { ?>
<div class="entry-summary">
<?php if (has_post_thumbnail()){ ?>
<?php if($audiohover == '5') { ?>
<div class="view view-fifth">
<?php the_post_thumbnail(); ?>
<div class="mask">
<a href="<?php echo esc_url_raw( $url ); ?>" class="info" target="_blank"><img src="else" /></a>
</div>
</div>

<?php } elseif($audiohover == '6') { ?>
<div class="view view-fifth">
<?php the_post_thumbnail(); ?>
<div class="mask">
<a href="<?php echo esc_url_raw( $url ); ?>" class="info" target="_blank"><img src="else" /></a>
</div>
</div>              

<?php } elseif($audiohover == '4') { ?>
<div class="view view-fifth">
<?php the_post_thumbnail(); ?>
<div class="mask">
<a href="<?php the_permalink(); ?>?fromwhere=audio"" class="info"><img src="img" /></a>
</div>
</div>

<?php } if($hide) { ?>



<?php } ?>

<?php } ?>

<?php } ?>

Summary of What I want to Achieve: I want to select if a post will be displayed or not in its respective category page. Example: I post something under the News category. When I goto the news category page, I want to be able to chose if the post filed under the news category will be visible or not. My way of doing this as of right now is through custom fields. Read the question to see why it isn’t working properly! 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:45:37+00:00Added an answer on June 16, 2026 at 1:45 pm

    You may try this:

    $hide = get_post_meta( $post->ID, 'hide', TRUE );
    
    if ( $hide != '' ) {
      // Don't display
    }
    else {
      // Display post
    }
    

    UPDATED

    All the code in your update is for one category, in this case audio, so this condition should be at the top, like this:

    <?php
    if ( is_category( 'audio' ) ) {
    $hide = get_post_meta( $post->ID, 'hide', TRUE );
      if ( $hide != '' ) {
      // Don't display
    }
    else { ?>
    
    <div class="entry-summary">
    <?php if ( has_post_thumbnail() ) { ?>
        <?php if ( $audiohover == '5' ) { ?>
          <div class="view view-fifth">
            <?php the_post_thumbnail(); ?>
            <div class="mask">
              <a href="<?php echo esc_url_raw( $url ); ?>" class="info" target="_blank"><img src="else" /></a>
            </div>
          </div>
    
          <?php
        }
        elseif ( $audiohover == '6' ) {
          ?>
          <div class="view view-fifth">
            <?php the_post_thumbnail(); ?>
            <div class="mask">
              <a href="<?php echo esc_url_raw( $url ); ?>" class="info" target="_blank"><img src="else" /></a>
            </div>
          </div>
    
          <?php
        }
        elseif ( $audiohover == '4' ) {
          ?>
          <div class="view view-fifth">
            <?php the_post_thumbnail(); ?>
            <div class="mask">
              <a href="<?php the_permalink(); ?>?fromwhere=audio"" class="info"><img src="img" /></a>
            </div>
          </div>
    
          <?php  } } } }?>
    

    That is, if I understood right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know the title is ridiculously long, but I'm in need of some assistance
Long title, but simple problem. I am trying to let a window stick to
Long title but hopefully it explained most of what I need to say. Basically
A long title, but I wanted it to be specific. The title is really
Apologies for the long winded title but looking for a solution to what might
The title is a bit long, but it should be pretty straightforward for someone
Sorry for a long question and not a very descriptive title, but my problem
I am stuck with my web application. As known from the title its a
I know I asked a similar question to this not long ago, but I'm
Sorry for the long title but couldn't think of a good way to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.