WordPress.org

Ready to get started?Download WordPress

Forums

Is there anything like "post pool" for the wp Loop? (7 posts)

  1. janosd
    Member
    Posted 5 years ago #

    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.

  2. MichaelH
    Member
    Posted 5 years ago #

    Do you mean something like:

    $args=array(
       'category__in' => array(2,109,165)
       );
    query_posts($args);
  3. janosd
    Member
    Posted 5 years ago #

    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.

  4. janosd
    Member
    Posted 5 years ago #

    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?

  5. janosd
    Member
    Posted 5 years ago #

    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() ?

  6. janosd
    Member
    Posted 5 years ago #

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

  7. janosd
    Member
    Posted 5 years ago #

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

    cheers

Topic Closed

This topic has been closed to new replies.

About this Topic