WordPress.org

Ready to get started?Download WordPress

Forums

a different approach: still puzzled (4 posts)

  1. dss
    Member
    Posted 9 years ago #

    I've been trying to devise a method, in my new-to-php way, where my archives will show one post, and then list the rest (somewhere, anywhere on the same page) as titles and meta only.
    latest effort was:
    <?php /* If "news" category archive 2 */ if (is_category(2)) { ?>

  2. <h2><?php _e('Recent News:'); ?></h2>
    </hr>

      <?php c2c_get_recent_posts_news(35); ?>
  3. <?php /* If Booking category archive 4 */ if (is_category(4)) { ?>

  4. <h2><?php _e('Recent Bookings:'); ?></h2>
    </hr>

      <?php c2c_get_recent_posts_booking(35); ?>
  5. and with only one of these inserted, it works! the plug calls 35 of the recent posts, and the sidebar displays them just right.
    however, then when i add the second (and i was hoping to have 4 total) it breaks and gives me an unexpected T_IF (or T_ELSEIF if i use that.)
    here's what i did:
    I duplicated the function c2c_get_recent_posts in Scott's custom posts plugin, and specified the category for each instance, and named them accordingly.
    both work, just not together.
    So i suspect it's the `if (is category(X)) that's going bonkers.
    how can i call multiple copies of this plugin using different categories?
    or, is there an easier way to get recent posts by category into my archive side bar on a cat by cat basis?
    man this is rough... nothing's working.

  • Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    Where are your }'s?

  • dss
    Member
    Posted 9 years ago #

    here:
    <?php } ?>

  • below the above tags.

  • dss
    Member
    Posted 9 years ago #

    yesss....
    thank you for getting me thinking differently.
    this worked:

  • <?php if (is_category(2)) {include "recentnews.php"; ?> <?php } ?>
    <?php if (is_category(4)) {include "recentbooking.php"; ?> <?php } ?>
  • wow... bedtime. i feel like a ton of bricks just got gently removed from my head.
    thanks!!!!!!

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.