• Resolved Cathy Tibbles

    (@multitalentedmommy)


    This is the first string I’ve needed in my category template – i want to alphabetize posts IF in category 7 or 3. This (my guess) is obviously not viable! Can anyone help me with this?

    <?php
    if (is_category('7'))
    {   $posts = query_posts($query_string .
        '&orderby=title&order=asc&posts_per_page=10')
    }   else
        if(is_category('3'))
        $posts = query_posts($query_string .
        '&orderby=title&order=asc&posts_per_page=10');
        if (have_posts()) : while (have_posts()) : the_post(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Probably a missing { after else… then somewhere closing it…

    But why don’t you just make a category-7.php and a category-3.php template file – so you don’t have to struggle with conditionals?

    Thread Starter Cathy Tibbles

    (@multitalentedmommy)

    ummmmm, cause I didn’t think of it! I will do exactly that. I know your approach is to stay away from coding, I just have a hard time seeing the wordpress logic. Whereas, computer logic is intuitive, and it’s a matter of syntax. (which I guess is quite a BIG matter!)

    🙂 thanks a ton, I’m going to make category templates now. 🙂

    When it comes about template… the “logic” is outlined here:
    Template_Hierarchy.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘some1 help with my syntax? $posts=’ is closed to new replies.