79360855

Date: 2025-01-16 08:49:17
Score: 0.5
Natty:
Report link

How are you creating the Custom Post Loop page? If you are using a page builder, please add which builder you are using.

The following solution assumes that you are using a custom code for the "Custom Loop Page":

<?php
if ( have_posts() ) :
    while ( have_posts() ) : the_post();
        $categories = get_the_category(); // Get the categories for the current post
        $is_coming_soon = false;

        foreach ( $categories as $category ) {
            if ( strtolower( $category->name ) === 'coming soon' ) {
                $is_coming_soon = true;
                break;
            }
        }
        ?>

        <div class="post <?php echo $is_coming_soon ? 'coming-soon' : ''; ?>">
            <?php if ( $is_coming_soon ) : ?>
                <span class="post-title"><?php the_title(); ?></span> <!-- Not clickable -->
            <?php else : ?>
                <a href="<?php the_permalink(); ?>" class="post-title"><?php the_title(); ?></a> <!-- Clickable -->
            <?php endif; ?>
        </div>

    <?php
    endwhile;
endif;
?>
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): How are you
  • Low reputation (1):
Posted by: Amit Singh