• I’m using WordPress. I have a movie review website called https://filmblurb.org. For my blog posts, I’m trying to create posts with different categories. Under the “Reviews” category, I have a “Details” box that serves as meta information for all my reviews. The problem is when I try to create a post that has the category of “Features” or something else, that “Details” box still remains. Basically, I want to try to create a PHP if statement that will only return the following code sequence when I only write a “Reviews” post. I’m using the “get_post_meta” tag in WordPress to fill in this “Details” box for every “Reviews” post I write. A sample post can be found here: https://www.filmblurb.org/reviews/97. Can anybody help me on this? I would appreciate it. Let me know if I need to explain more.

    <div class="box">
        <div class="boxheader">Details</div>
        <div class="text">
        <h1>Genre</h1>
        <p><?php echo get_post_meta($post->ID, 'genre', true); ?></p>
        <h1>Rated</h1>
        <p><?php echo get_post_meta($post->ID, 'rated', true); ?></p>
        <h1>Release Date</h1>
        <p><?php echo get_post_meta($post->ID, 'releasedate', true); ?></p>
        <h1>Runtime</h1>
        <p><?php echo get_post_meta($post->ID, 'runtime', true); ?></p>
        <h1>Director</h1>
        <p><?php echo get_post_meta($post->ID, 'director', true); ?></p>
        <h1>Cast</h1>
        <p><?php echo get_post_meta($post->ID, 'cast', true); ?></p>
        <h1>Grade</h1>
        <p><?php echo get_post_meta($post->ID, 'grade', true); ?></p>
        </div>
    </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Need help on creating If-statement in WordPress’ is closed to new replies.