• Resolved Danny159

    (@danny159)


    Hi,

    I have the following code in a template file (page-home.php) and I want to include bits of different pages in this file:

    I have the following code:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    However the second loop doesn’t work… the ID is correct it just doesnt show anything…

    Can anyone please help and spot my problem!

    Dan

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Danny159

    (@danny159)

    Please see the code here: http://pastebin.com/W1MPqEa0

    Michael

    (@alchymyth)

    I can’t see anything wrong with these near identical two blocks of code –

    apart form using query_posts() for secondary loops; better to use WP_Query()http://codex.ww.wp.xz.cn/Function_Reference/query_posts#Caveats

    have you checked the html output in the browser, to see if the second loop’s output is possibly just hidden?

    what happens if you swap the page IDs between the queries?
    does the page 70 have direct children?

    Thread Starter Danny159

    (@danny159)

    Hi Thanks for you reply…

    I replaced some code and added:

    <?php
    	$the_query = new WP_Query(array('page_id' => "18", 'post_type' => 'page'));
    	while($the_query->have_posts()) : $the_query->the_post();
        ?>

    I changed the id’s around and still nothing… actually nothing at all shows now except my recent posts….

    Here is my full new code: http://pastebin.com/07D6Zd9R

    Dan

    Also no pages have children yet

    Michael

    (@alchymyth)

    Also no pages have children yet

    you were running queries looking for children pages….

    http://codex.ww.wp.xz.cn/Class_Reference/WP_Query#Post_.26_Page_Parameters

    [edit]
    just saw the edited queries; if those pages exist, there should be some output.

    do you get at least the two empty divs?

    <div class="column_small" style="width:290px;">
    </div>

    where is that pastebin code inserted in which tempalte?

    Thread Starter Danny159

    (@danny159)

    Ahhh but even this doesnt work:

    <?php $the_query = new WP_Query('page_id=18'); ?>

    Sorry for been stupid!

    Thread Starter Danny159

    (@danny159)

    Yes I get that… 🙁 dont know why…

    Dan

    Thread Starter Danny159

    (@danny159)

    My full template code: http://pastebin.com/DTTnWNvU

    Thread Starter Danny159

    (@danny159)

    I fix this problem… I changed $the_query to $front_query1 and $front_query2 and now it all works.

    Thanks for your help!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Multiple Loops’ is closed to new replies.