• Hi guys ??

    My first post here. Im newbie in wordpress, kinda post-newbie in PHP ?? (i programmed a social networking engine not long ago).

    I have a question.

    I have read the codex but i still dont really understand how the wp loop works.

    How can i give a query to the wp loop? I mean by default it just calls have_posts(), innit? But where is the part which tells the loop to list posts by a certain criteria?

    If i have a complex self written mysql query how can i list that query with the default archive wp loop? Cause i dont want to mess up the code.

    I just want to do

    if (is_category(‘MySpecialCat’)
    {
    give the loop my special query to list
    }
    else
    {
    do the usual.
    }

    I hope its understandable, english isnt my native language and i havea messed-up thinking anyway.

    Thanks for understanding. Cheers.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Do you mean something like:

    $args=array(
       'category__in' => array(2,109,165)
       );
    query_posts($args);

    Thread Starter janosd

    (@janosd)

    yep since then i found the query_posts codex page :-D.

    but for me its not working, at least never the way i want.
    lets say i have got a custom field called “datum” (means date).

    i didnt put dates into it but integers for test first.
    here is what i did:

    if (is_category('Uncategorized'));
    	{
    	query_posts('meta_key=datum&orderby=meta_value&order=ASC');
    	}

    should it work? cause it does not.

    thanks for your attention.

    Thread Starter janosd

    (@janosd)

    ahha! i think i read sg like this before here on the forum:

    the ordering is not working properly. it orders about the half of the posts but every time a value pops in here and there…

    any ideas?

    Thread Starter janosd

    (@janosd)

    okay i found it! the wp meta_value is a longtext type but i try to compare integers. any way to change its type tru query_posts() ?

    Thread Starter janosd

    (@janosd)

    i found a not too pretty workaround but im still interested in how can i define the type of the custom field.

    Thread Starter janosd

    (@janosd)

    ehh sorry, i was talkin bollox, forget it :S.

    cheers

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Is there anything like “post pool” for the wp Loop?’ is closed to new replies.