• I’m trying to create a new page within which I can run a different loop from the one on my homepage. I think I’m able to manage the loop but I’m struggling with something more basic.

    I began by creating a new page titled “Also”, and put a bit of test text inside the “Page content” box. Then I saved page.php as a new page template (with the name “Also”), put the required 5 lines of code at the top (template name etc), and then selected it as a template for the page “Also” in “Page options” in the WP admin area.

    The template is displaying correctly except that what I’m seeing in the content section of this page is the page title and the bit of test text. The standard WordPress loop seems to be having no effect.

    What should I do to run a loop within this page template?

Viewing 4 replies - 1 through 4 (of 4 total)
  • What type of info are you trying to produce with the page? The Page will generally only return the data you assign to that page, not a variation of your index.php, as I understand it. One option, if you are trying to do what I think you are, is to rename your index.php as home.php, and then tweak the loop as you would like and save that as index.php. You could then create a link called Also that points to your index.php, thereby giving you two separate looks at your loop. If I’m mistaken, maybe clarify what it is you are trying to accomplish with the Also page.

    Thread Starter pcmt

    (@pcmt)

    Well, on one of my back pages I wanted to display posts in a specific category (not displayed elsewhere). I already have two different loops running on the homepage.

    I’ve more or less achieved the desired effect through a category instead of a page, which seems okay as WordPress navigation doesn’t distinguish between the two.

    Thread Starter pcmt

    (@pcmt)

    Still having problems.

    What is the best way to create a new page that contains the WordPress loop? I have tried two methods so far, without success.

    The first method was to create a page by saving page.php as test.php and uploading it to the same folder. But I could find no way of navigating to it as /test/. I got the error404 page.

    So I made a new template (as described in the codex), then created a new page in admin and selected the new template. As I see it, the new template needs 2 loops: one for the page content at the top (entered in admin) and another for the extra list of posts of a specific category I want underneath. It works to a degree, but the posts in the second loop do not display the “Continue reading >>” link – the whole of the posts are displayed, which I don’t want.

    Even when I remove the first loop altogether, the “Continue reading >>” links in the category-specific posts underneath do not appear. Am I doing this correctly or should I be using another method altogether?

    To recap: I want a page that has a heading and a paragraph of text, then below, a list of posts from a specific category but with the functionality of <!–more–> in each post.

    Assistance would be much appreciated.

    pcmt, you’ll want to initialize The Loop in your Page template using query_posts():

    http://codex.wordpress.org/Template_Tags/query_posts

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Creating a new page with a different loop. How?’ is closed to new replies.