WordPress.org

Forums

[resolved] Call Pages instead Posts (6 posts)

  1. deathlynotes
    Member
    Posted 3 years ago #

    Hi.
    I have a theme named Africa, and there is a code at magazine format which calls posts, but I need it calls pages.
    I have Map Categories to Pages plugin from Amit Verma installed. So, I want call a specific category, and show pages which is listed under that specific category.
    The code that I have to change is:
    <?php $recent = new WP_Query("cat=".$featured5_bottom_left."&showposts=".$featured5_top_num); while($recent->have_posts()) : $recent->the_post();?>
    Please, someone can help?
    And yes, I looked at forum, google, etc.
    Thanks and have a nice week
    Lee

  2. david.bailey
    Member
    Posted 3 years ago #

    <?php $recent = new WP_Query("cat=".$featured5_bottom_left."&showposts=".$featured5_top_num."&post_type=page"); while($recent->have_posts()) : $recent->the_post();?>

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

    Try this.

  3. deathlynotes
    Member
    Posted 3 years ago #

    Hi
    Thanks for your answer.
    Well, your code works, but just for only one category (cat=12).
    Its 4 blocks, which have categories 4, 12, 14 and 8, but only cat 12 worked. I tried name WP_Query("cat=14" but it didn't work.
    But thank you again. I will read about wp_query.
    =)

  4. david.bailey
    Member
    Posted 3 years ago #

    I assumed the rest of the query you wrote was what you were going for. If you want all the categories I would remove the category specifier, or you should probably be able to add an array of values.

  5. deathlynotes
    Member
    Posted 3 years ago #

    Hey
    It did work!
    I'm just stupid, you know... I forgot to change block positions in code (left, bottom, top, right). LOL
    Now it's all working.
    Thank you, David!
    You saved my life. =)

  6. david.bailey
    Member
    Posted 3 years ago #

    No problem

Topic Closed

This topic has been closed to new replies.

About this Topic