• Hi,

    I hope someone can help. My wordpress knowledge is limited – especially the Codex.

    I’m building a page, where I want multiple content sections.

    I’ve been using an ‘apply_filters’ function to get content, by passing the pagename as an argument. Since I’d like to call it dynamically I’m now stumped.

    Here’s what I’m after:
    A page by the name of ‘train’ calls page ‘train-a’ and ‘train-b’ to incorporate their content into its page. Allowing the user to update 3 different page contents that can be styled in the theme into one page.

    A page called ‘buses’ would call ‘buses-a’ and ‘buses-b’ and so on.

    I’m writing this into the page template, so that the user can just add other clusters of pages as they need.

    As I can’t pass the pagename variable as an argument in the function (? I think? – it’s not working), I’m lost.

    Thanks in advance for any kindly pointers.

    Tony

    ps… needs to be slug or pagename, rather than ID, as user won’t be able to set the page ID, but can set the slug.

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you used a tightly defined process of train’ calls page ‘train-a’ & ‘train-b’ and are inside the main Loop, then it should be possible to do this via WP_Query() using something like:

    $query1 = new WP_Query( 'post_name=' . $post->post_name . '-a' );
    [do extra loop 1 stuff]
    wp_reset_query();
    $query2 = new WP_Query( 'post_name=' . $post->post_name . '-b' );
    [do extra loop 2 stuff]
    wp_reset_query();
    Thread Starter tonyfogarty

    (@tonyfogarty)

    Thanks Esmi, That’s introduced a new idea to me that I can do something within the loop. Although whatever I’m trying to do isn’t working. Need to learn more about the loop too!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Calling a page from within a page.’ is closed to new replies.