WordPress.org

Ready to get started?Download WordPress

Forums

Modifying a weird loop? (3 posts)

  1. 3Joe3
    Member
    Posted 2 years ago #

    Ok everyone, I have a loop that is absolutely NOT cooperating with me. I need to mod this loop to ONLY include a category called 'bbin.' I've scoured the internet trying to figure this out and I've found a bunch of code that SHOULD work, but I keep getting an endif error. Please help!

    Here is the code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    not knowing what you tried so far,
    try and add a line like this before your loop:

    <?php $bbin = get_cat_ID('bbin'); query_posts( array('category__in' => array($bbin), 'paged' => get_query_var('paged') ); ?>

    based on 'bbin' being the category name:
    http://codex.wordpress.org/Function_Reference/get_cat_ID

    http://codex.wordpress.org/Function_Reference/query_posts

    http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

    (untested)

    ps: the 'endif error' is probably caused by breaking the php syntax in some way. therefore, it would have helped if you posted at least one of the failed attempts.

  3. 3Joe3
    Member
    Posted 2 years ago #

    Ok, here is the original code again:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    Here is where I've found the most information on modifying the loop (in case you care to check it out):

    http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

    This is the code I used from the link above, that I was hoping would work:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    And here is the error message I get:

    Parse error: syntax error, unexpected T_ENDIF in /home2/mountat5/public_html/wp-content/themes/kelontongfree/home.php on line 84

    This is line 84:

    endwhile; endif;

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic