• Hi:

    Would someone who understands code please look at Example 1 and Example 2 of my page.php file?

    The code is at https://pastebin.com/506071

    Example 1 only brings up a blank page when I create a new page.

    Example 2 brings in the template, but only allows one post to a Page.

    Can you see what is broken in the code in Eexample 1 so that I can get it working?

    Very appreciative,
    ken

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try to do this loop:
    ‘<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>’
    instead off:
    ‘<?php if (have_posts()) : while (have_posts()) : the_post(); ?>’

    1. <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>

    That’s the WP 1.2.x Loop. The other one is for WP 1.5. and higher.

    2. Example 2 brings in the template, but only allows one post to a Page.
    That’s the normal behaviour – a Page is like a “single post. No multiple Pages on display in any WP install on the same ‘webapge’.

    3. The faulty (blank) template has these lines that are not needed:

    <?php endwhile; ?>
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('? Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries ?') ?></div>
    </div>
    <?php endif; ?>

    Thread Starter kenwinstoncaine

    (@kenwinstoncaine)

    Thanks.

    Yes, to get Example 2 to work, I had deleted that “navigation” stuff. Not sure what it was meant to do or how it showed up there.

    Thanks for looking.

    I’m experimenting with a plug-in that was designed to allow multiple posts to a Page in WordPress 1.5. The author doesn’t know if it will work with permalinks, but has demonstrated it working without them. I’m using permalinks, so that must be why it is not working for me.

    Had thought it might have something to do with that odd “navigation” code or something else that I couldn’t see in the code on that “broken” page.

    Thanks a lot for looking and weighing in.

    kwc

    I found that plugin idea totally counter-productive and against the basic concept of WP… so don’t expect any help on that from me ??
    [and let’s not start an argument about this – I’ll cut it]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can you see what’s wrong with this page.php code?’ is closed to new replies.