• I made a theme and whatever page I submit a post it ends up on my homepage. is there a way to post to specific pages that are not the homepage? How do you do this?

    If im on page id=3 I want to be able to post and see posts on that page.
    If im on page 1d=59 I want to be able to post and see the posts ont that page too.

    Do I need to alter the PHP in the LOOP of my theme to do this or is there something elso im missing.

    thanks
    Rob

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    That sounds like a page of posts, so give this a read.

    http://codex.wordpress.org/Pages#A_Page_of_Posts

    Play with the $args to get the query_posts($args); to display only what you want. In that example the $args are controlled by

    args= array(
    	'category_name' => 'antiquarianism, championship', // Change these category SLUGS to suit your use.
    	'paged' => $paged
    );

    You can use different criteria for selecting which posts get picked.

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

    Also WP_Query is a good way to select what you want too.

    http://codex.wordpress.org/Class_Reference/WP_Query

    Thread Starter roclimb

    (@roclimb)

    Thanks so much for the help/reply. I read through the page of posts codex page and this really helped to start to get what I need. What I am really looking for (I think) is a way to get the current page id–which is actually the post id as I cant find page id in the codex?

    I think if I get the page/post id I can somehow make the post, post on the same page. Any ideas on how to do this????

    The reason I need to do it this way is I am going to have probably 50 or more pages with the need to post on that page and post “to” that page. If I do this with categories in an array I wont have unique post data on all 50 pages like I need. At least that’s what I think.

    Any suggestions
    Thanks again for taking the time
    Rob

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    is a way to get the current page id–which is actually the post id as I cant find page id in the codex?

    You can get the ID and check if it’s a page or a post using get_the_ID().

    http://codex.wordpress.org/Function_Reference/get_the_ID

    ID’s are unique (I recently was reminded of that!) and you can easily test if the ID is for a page or for a post. See this pastebin link for a simple example.

    http://pastebin.com/aLaUuwNR

    The reason I need to do it this way is I am going to have probably 50 or more pages with the need to post on that page and post “to” that page.

    Not sure what you mean by that. 🙂 The post of pages link is a template to be applied to a page. You set up the conditions in the template and apply the template to the page.

    When people visit the page, the template kicks in and they see the posts you’ve setup in that template.

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

The topic ‘Posts on specific pages’ is closed to new replies.