WordPress.org

Ready to get started?Download WordPress

Forums

Add Post Date ONLY to certain Category ID posts (1 post)

  1. HelpfulHorseHints
    Member
    Posted 1 year ago #

    I am trying to create a blog on my business website (blog: http://www.familyhorses.net/extreme-rescue-makeover/). I created a page that includes only posts for the specific category (the blog). That aspect works OK. Now I want ONLY those posts to display their date / time.

    This is the code I am trying to use.

    <?php web2feel_posted_on(); if (is_page('extreme-rescue-makeover')) {
      $catID=4; } ?>

    In this location, the code correctly displays the timestamps of the posts...but also displays the timestamp on all other pages, i.e. FAQ (but not other post categories). I have tried various other locations, the only other thing I could get it to do was display the postdate of the page but not the individual post. In each case I am failing at restricting the date to posting only for posts of Category ID 4. I am sure the solution is simple...I just can't seem to get it.

    <?php
    $catID = 0;
    if (is_page('extreme-rescue-makeover')) {
      $catID=4;
    }
    
    if ($catID) {
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       query_posts("cat=$catID&paged=$paged");
    } ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php web2feel_posted_on(); if (is_page('extreme-rescue-makeover')) {
      $catID=4; } ?>
      <?php get_template_part( 'content', 'page' ); ?>
    
    					<?php comments_template( '', true ); ?>
    
    				<?php endwhile; // end of the loop. ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by HelpfulHorseHints
  • This topic is not resolved
  • WordPress version: 3.5