WordPress.org

Ready to get started?Download WordPress

Forums

Display a Post AND a Page (5 posts)

  1. SteelRat
    Member
    Posted 8 years ago #

    Hello All.

    I've set myself the task of migrating this site http://www.2dforever.com/ to WordPress (I've chosen WordWress because it seems to have really good documentation and is very open to customisation)

    I'd like to display a specified post and page in one document, and keep these dynamic, so for example, I can show the about page with the 136th post (http://www.2dforever.com/about/image136#content).

    I tried throwing /?p=N&page_id=N at my WordPress URL, but this results in 'Sorry, no posts matched your criteria.'

    digging into the source, I find this code in p-includes/functions.php

    // First, check to see if there is a 'p=N' or 'page_id=N' to match against
    preg_match('#[?&](p|page_id)=(d+)#', $url, $values);
    $id = intval($values[2]);
    if ( $id ) return $id;

    This gives me the impression that the page/post seperation is something fundimental to WordPress' operation, and no simple plugin is going to allow what I want to do.

    I'm going to look into modifying this rule to see if I can get both the identifiers to be sent to the templates, unless someone can suggest a better way of going about it without hacking the core WP framework

    Thanks.

  2. davidchait
    Member
    Posted 8 years ago #

    this sounds like particularly custom code.

    you could use a custom page template, that knew how to look up what associated page to show.

    you could use a custom index.php in general, that would have the same sort of logic, to find the 'other' piece of content.

    in both cases, you'd do a second posts loop to look up whichever piece is missing. maybe using a post-meta field to link the two.

    -d

  3. SteelRat
    Member
    Posted 8 years ago #

    Unfortunately the pages and posts aren't associated with each other. I want the user to be able to browse pages and posts independently, but on the same screen.

  4. davidchait
    Member
    Posted 8 years ago #

    Huh??

    Sounds like a good use for frames. ;) No, seriously. You want two sections on your page, each independently changeable... Sounds like frames to me.

    If there's more to it than that, explain away..

  5. SteelRat
    Member
    Posted 8 years ago #

    That's it. But to ensure I keep my URLs nice, I'd need to reload the whole page (frames et al), so I'm still asking to send both post and page variables.

    However this gives me the idea of using a custom container page that interprets the URL (that will have both post and page requests) and processes two loops (one for the page varible, another for the post).

    Problem now is, how do I get WP to output my customised URL with both page and post request included?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags