How to: Add Posts to Pages in WordPress [Tutorial]

March 4, 2011    106 Comments

How to Add Posts to Pages in WordPress Tutorial

Adding Posts to your WordPress Pages is handy for driving traffic to your blog from pages on your site.

If you’re trying to add posts to pages in your WordPress website, this how to guide is for you.

Maybe you want to add posts to the bottom of your pages… or maybe you want to put them in the middle of your pages.

You probably want to only add certain posts to certain pages, and you want a way to specify which posts goes on which pages.

Your goal might be putting specific posts on a page other than your home page.  That is, adding a certain set of posts to a page that is NOT your homepage, or “posts” (or “blog”) page.

If one of those situations apply to you – this tutorial is for you. (skip down to the tutorial)

A quick aside: There is going to be a lot of talk on posts and pages…
if you don’t know the difference – read about WordPress SEO & Posts vs Pages

How to: Add Posts to Pages in WordPress

To my knowledge, there is no “easy” way to do this – you’re going to have to get in the code (for some people, this is exciting).

You will need to have some knowledge (or not be afraid to dabble and mess with) of: HTML, PHP, WordPress file structure (specifically, how themes work & FTP), and WordPress in general (administration, adding categories, editing pages, writing new posts and putting them in certain categories).

If you want to make the posts that will appear on your pages “look pretty” (or look consistant with the rest of your website) – you will need to be comfortable playing with CSS as well.

IF any of that stuff above scares you, I recommend NOT reading this and asking us for help.

Otherwise – let’s add posts to pages in WordPress!

Here is a simple outline, or table of contents if you will, of the steps we will be taking.

  1. Make a new custom page template
  2. Make a new post category (or use an existing one)
  3. Add code to the new page template
  4. Change a page to run on the new page template
  5. Add a new post to the new (or chosen) category
  6. Check to make sure it works & Ta-Da!

For this “how to” – I’m going to use an example: Suppose you have a page on your website called Stories and you want to add posts under that page.  Each post will be a stand alone “story”, and the collection of all these posts will live under the page called Stories.

Let’s get to it.

1. Make a New Custom Page Template

We are going to create a new set of code for WordPress to execute when the visitor is viewing the page that we want our posts to appear on.

Adding a customized page template is easy… check out WordPress page templates codex.  Don’t worry, I’ll give you the quick step by step for you now:

Look in your theme folder for page.php – did you find it?  If not, open index.php instead.

Copy the contents of that file into a new file called page-stories.php.

At the VERY TOP of that file, add this code:

<?php  /* Template Name: Stories */ ?>

Congratulations, you’ve added a new page template to your WordPress theme. Yay! – BUT: this page template does nothing different than the default page template because we didn’t change any code (yet).

OK – keep that new page (page-stories.php) open for now – we will come back to it really shortly.

2. Add a New Category (or chose an existing one)

Let’s add a new category called, you guessed it, “Stories”.

If you already have a category that has a bunch of posts in it and you want to pull posts from that category onto a certain page, we can do that too.

All you really need is to grab the ID of the category you want to use.

To do this, click on the category of choice as though you were going to edit it.  This will open the category edit (or “detail”, as I like to call it) page.

Look at the URL in your address bar and find the number that comes after tab_ID=.

Get Category ID in WordPress

Finding the category’s ID

In this case, our category ID is 38 — write that down, remember it, we will need it very shortly.

3. Add Code to Custom Page Template

This is the critical step in adding posts to pages in WordPress.

Remember that custom page template that we created earlier?  We called the file page-stories.php … you kept that file open right?

Here is the tricky part.  It’s tricky because you have to understand what the code is doing to be able to place this next piece of code in the right place.

I will do my best to explain:

This next piece of code that you’re going to add to your custom page template is going to look for posts in a certain category and output them onto the page.

In this example, we are going to put the posts AFTER the page content.

Important Note: You cannot put this code in the middle of the WordPress loop.  It won’t work.  You MUST put the code outside of the first loop.  See the picture below:

WordPress Page Template Code Loop

Put the code (found below) in the highlighted area — AFTER the ending of the first WordPress loop

Here is the code to put into your custom page template.
Remember, the template is called “Stories” and the file is page-stories.php.

<br />
<?php<br />
global $more;<br />
$more = 0;<br />
query_posts('cat=38');<br />
if(have_posts()) : while(have_posts()) : the_post();<br />
<p><a href=&amp;quot;<?php the_permalink(); ?>&amp;quot;><?php the_title( '</p>
<h3>', </h3>
<p>' ); ?></a></p>
<p><?php<br />
endwhile;<br />
endif;<br />
wp_reset_query();<br />
?><br />

Please Note: See in the second line it says cat=38?  That 38 is the tab_ID that we found in the URL of the category editing page earlier (I didn’t tell you to remember it for nothing).

So you want to change that cat=38 to the tab_ID of the category that you found, make sense?

Update (11-29-12): Added the global $more variable & set it to zero.. this is to ensure the “read more” functionality works.

That should add posts in that category to the page that runs the template we created earlier.  But first you have to tell the page to run that template…

4. Update a Page to Run the Page Template

Do you know which page you want to add posts to?  If so, navigate to editing that page… otherwise, add a new page.

Underneath the big blue “Publish” button, there should be a section called “Page Attributes” — find this.

One of the page attributes is “Template”.

Change your page template to “Stories” and re-publish your page.  Make sure you check the page to make sure nothing is broken.

Change Page Template WordPress

Change the page template of the page you want the posts to show up on

That was an easy step :) – The next one should be too.

5. Add a Post to the Chosen Category

I hope that headline is self-explanatory… but make sure you add the post to the category that you’re using to pull posts onto the page.

Yes, you CAN put the post in multiple categories, just as long as one of them is the category that you chose earlier.

If you chose a category that already had posts in it, you can skip this step and move onto…

6. Check to Make Sure it Works & TA-DA!

Did you successfully add posts to your WordPress page?

All you have to do to check to see that it’s working is refresh the page that you chose to display posts on (that which you changed the template of in step #4 above.

Here is a before and after of my blog after following the steps above.

Before & After of adding posts to pages in WordPress

Before & After

That’s it.  If you successfully followed this tutorial, you have added posts to pages in WordPress.

If you run into any problems or just can’t seem to ass posts to pages, there are several next steps you could try:

  1. Try again.
  2. Comment below – someone else might have the same problem and your comment could help them solve it!
  3. Click here to contact us – we do this stuff in our sleep and are always happy to help!

Until next time, this is Arsham signing out :)

Written by: Arsham Mirshah (79 Articles)

WebMechanix co-founder, technical SEO, Google analytics junkie, & web dev'r who loves to ski, play tennis and demonstrate ROI.

Follow Arsham on Twitter    
  • Andrew

    I’ve used the Associated Posts plugin and I find it a great way to have a gallery-esque view of posts on a certain page. I use it for our services page:

    • Arsham Mirshah

      Yes, yes! That plugin is money…

      The method described above is a dynamic approach, so you don’t have to go to the plugin and add new posts each time you add one.

  • chiko

    It doesnt wotk in my site.
    seems that the post doen’t appear under the page.

    the code :
    query_posts(‘cat=38’);so I have to change it like this ?query_posts(‘cat=tab_id’);


  • Arsham Mirshah

    So does it ultimately work?

    Some themes are different in that they already do a query_post() to populate some other area of the site… in those cases you have to use a wp_reset_query() before your query_posts().

    • Junaid

      Hi, it works perfect. I have a problem though.. The page for now is showing me short paragraph of page content and showing me full content of post.. What i need is totally oposite. I need to show full content of page and then posts having short discription with Read More link.. is it possible?
      Please help soon.Thanks 

      • Arsham Mirshah

        Yes, this is very possible. I don’t see why it would change anything to the page content — could you send me a link to the page that you are working on? (fill out our contact form and say attn: Arsham)

        As for the posts showing a short description :: You can either use the_excerpt() (instead of the_content()) OR see this page (below) for how to use the tag. Use the MORE tag to tell WP where to cut off the preview content and link to the full post.

  • Admin

    Thank you for posting this tutorial!!! I’m not familiar with php at all. However this tutorial plus a few minutes on helped me make a “page of posts” AND tweak it to work with the wordpress theme I’m using.


    • Arsham Mirshah

      That would be my pleasure P.L. – glad it could help… feel free to share your excitement with others :)

  • Sharon

    I understand how to add the content, but you have lost me with creating a new file first  (Copy the contents of that file into a new file called page-stories.php.) can you please advise me how to create this new file?
    Thanks for your help, Sharon

    • Arsham Mirshah

      Sharon, it would be my pleasure to help you.

      You want to copy the contents of page.php into a new page called “page-SOMETHING.php” — You will need an FTP program (like FileZilla or PSPad or DreamWeaver) to do this.

      Are you familiar with FTP Sharon?

      I can help you accomplish this if you’d like… let me know.

  • George Ivanoff

    Brilliant! Many thanks.  I’ve just used this tutorial for my site and it all works wonderfully. One question, though. Now that I have posts with a certain category displaying on a particular page, is there any way of stopping those posts from also appearing on the homepage with all the other posts?

    • Arsham Mirshah

      Ah, happy to hear this George!

      There certainly is a way to accomplish this… but it depends on how your theme is set up.

      Look for a file within your theme directory called home.php — if that exists, it likely runs your homepage. Otherwise, it’s probably index.php that it running your homepage.

      Step 1: Find the file running your home page
      Step 2: Make sure that file isn’t running any other page (it very well could be)
      Step 3:

      Let me know if that helps George!

  • Paul

    I am having a problem with doing this. I have added the extra pieces of code and changed to tab_ID=xx.. Firstly my page.php does not look like yours, and after doing everything and going to page attributes in the page that I want to post to, it only gives me 4 options.. Default Template, Archives page, full width, and Sitemap.. There is no option for stories.. Can you maybe contact me for some help?
    Thank you,

    • Arsham Mirshah

      Paul – You might be using a Child theme but updating the parent theme… do you know which theme or theme framework you’re using?

  • shelly45840

    Is it possible to display multiple categories on a page? If yes, how would I add that to the template?

    • Arsham Mirshah

      Yes, it sure is possible. Try a couple Google searches and see what you can’t turn up… I can tell you that it will include the use of the “wp_reset_query()” function.

      Good luck & let us know how you fair… if you want our professional help, please submit our contact form.

  • Cory @BayAreaTech

    I’ve already used this trick on several websites, but I now have a question. I want to limit the number of post from a given category to 1 (most recent).  Sort of like displaying a “latest news”, and not all posts from a given category.

    • Arsham Mirshah

      You can try using the posts_per_page parameter in your query_posts() call — OR — get rid of the while part of the loop.

  • John

    Hey Arsham, great tutorial, it’s working wonderfully for me.  I have one question:  I have the posts from one given category populating a page nicely, but there are really too many posts in that category for me to want them all showing on one page.  I used the “Reading” settings to limit the number of posts on the page, but I’d like to generate an “Older posts” prompt to load the next group of posts, etc., page by page.  Any suggestions on how to do that?  (I’m using the Atahualpa theme)…


    • Arsham Mirshah

      Hi John, sorry for the delayed response.. hope you had a good Turkey day…

      To be honest, this wouldn’t be very simple. There are 3 options that I could think of:

      1 – Create a new page template that acts like a category page (but only pulls from that category). Set the query to only have 5 posts per page, then wordpress will automatically create the pagination for you. Then you can embed this new page within your page template using an iFrame.

      2 – Load all of the posts in that category and use jQuery to hide all but five. Then have a jQuery tabber that “pages” through the next 5 elements of the list of pages.

      3 – Use jQuery .load() function to use AJAX to grab the next 5 pages.. you would have to create a custom page template that accepts query parameters which load into the WP query that tell it where to start getting posts (I believe it’s ‘offset’)..

      None of these are relatively easy, but it is very possible. Let me know if this helps at all..

      • John.

        Thanks, Arsham!  This season has been hectic, so it took me awhile to get back to checking this page.

        I must admit I’m more in the category of “not afraid to dabble with” than “comfortable with” PHP, jQuery, WordPress file structures, etc.  I think (hope) your suggestions will put me on a track where I can figure out what I need to know, however… I appreciate your feedback!


  • Roshan Premachandra

    Great tutorial.

  • Miss Elric

    Great tutorial. Worked perfectly on my blog.

    I have a question though. How can I make my posts appear on top of the page instead after the content of the page? Is there a way to do this? Thanks!

    • Arsham Mirshah

      There certainly is a way, though maybe more difficult than is able to be written in a tutorial as every theme is different..

      Do you want us to have a look at your particular case? What’s the website you’re looking to accomplish this on?

      • DOS

        Firstly, great tutorial, one of
        the few I didn’t get frustrated and ditch mid way


        I’d also be interested on knowing
        how to make the posts appear at the top of the page. The site is, I’ve applied
        the new template to the Youth/Minis page under Teams.



        • Arsham Mirshah

          Because of the way that WordPress loads the page.. you’re going to need a plugin or custom CSS to position that pane above the rest of the content.

          I could do a tutorial for how to do that, if I had more time!

          Thanks for the kind words.

          Check out – he knows his stuff when it comes to WordPress.

  • Hitesh Saikar

    How do i access the php file? I have created my blog directly from I have not installed wordpress using Fantastico or any other tool. Can you please help?

    • Arsham Mirshah

      Unfortunately, you cannot access the PHP files that run your wordpress.COM installation.. this only works for self-hosted WordPress instances.. Sorry :(

  • sacbiznews

    Hi, thanks for the great information.I know absolutely nothing about this and you taught me perfectly. My only problem is the result I got looks like this:
    When I want the blog page to look like this:

    I’ve tried copying the page source of the desired page and it worked but it didn’t bring new content in. Any thoughts? I would greatly appreciate it.

  • sacbiznews

    Scratch my last post. I got everything working. Thanks :)

    • Arsham Mirshah

      Well done! Glad to hear it :)

  • Lisanelsonrd

    Arsham – Thank you! This is along the lines of what I’m looking for. Followed the steps without issue –

    However, I’d like for the two most recent blog posts to appear in the middle of a page and to just be the blog post title with a few lines of intro and link to read more.


    • Arsham Mirshah

      Hey there you’re welcome! Glad it worked for you..

      The method I used will show all the posts in the category. To limit the number of posts you want to show, try replacing “query_posts…” with:


      That will limit the number of posts returned to 2.

      THEN – to get it to show just a few lines (or a summary/excerpt).. replace “the_content(‘Read More’)” with:


      Read up on the_content and the_excerpt here: … you could leave the code how it is and put a “” in the content of your post to make it cut off and show the read more link :)

      Let me know if I can be of any more help :)

    • Arsham Mirshah

      PS if you don’t mind tweeting / sharing this.. I would GREATLY appreciate it :)

  • Sandy D.

    I have a quick question. ;) At most, I have 4 posts showing on my blog’s home page. I created a page to pull posts from others categories (from your tutorial—thanks!) Is there a way to show more than 4 without changing the amount of posts shown on my “home” page? Thanks!

    • Arsham Mirshah

      Hi Sandy D :) — You are welcome, glad it worked out for you.

      See this comment for instructions on how you might accomplish this… let me know via twitter (@webmechanix & @arshammm) if it helps :)

      Otherwise, comment again and I’ll see if I can’t help further.


  • Guest

    How would I edit the code so I could change the category by page? I have found this but couldn’t get it to work either on its own or with your code.

  • Arsham Mirshah

    That’s getting somewhat complicated..

    You COULD make different page template for each category (and just change the “category ID” parameter).

    Or – you could use a custom field to set which category to show posts from on that given page.

    This is definitely getting into more advanced WordPress Development.

    We can certainly do this for you and make it easy to manage, let us know if you’d like that.

  • Tim

    i cant seem to put the code in the right place on my page-x.php file.  wont work for me. hmmmm

    • Arsham Mirshah

      Not all WordPress installations are made equal… good luck Tim, let us know if we can help.

  • Andrew

    Thanks Arsham.  I was able to make these changes and get everyting working, but the posts are all bunched up.

    On my normal blog page there are blank lines and solids lines that seperate all of the posts.  But on the re-directed post-page there is no seperation or anything; they are all bunched up, line after line.  Any ideas?

    • Arsham Mirshah

      Sounds like a CSS issue my friend.. try viewing what CSS makes the blank space and solid line and replicate that on your post output.

      • Andrew

        Thanks, I got it figured out!!  I “borrowed” a little code from the single.php and worked it into your code and now it looks perfect!

        • Arsham Mirshah

          Good stuff Andrew, glad you got it working!

  • David Willoughby

    You rock!

  • Elnaz Sarraf


    This is a great post, Can you tell me how I can add post featured images (thumbnails) next to the post? I appreciate your help.

  • John

    I have managed to do this and the posts are appearing in the page I want, however, the posts are still sppearing on the home page which I don’t want, is there a way to exclude the newly created category posts from the home page? Thanks.

    • Arsham Mirshah

      Absolutely.. You want to find the template file that’s running the home page and modify that to not include the category IDs.

      I think the same query_post function will work but you put a negative category ID .. Or just include the categories you want.

      Good luck and let me know how it goes!

      • Brett

        Would you know what the file name could be for the home page?

        • Arsham Mirshah

          Generally, index.php runs your homepage.. but it could also be called: front-page.php, home.php, or page-home.php —

          Actually, it could be called anything really.. the best way to find out is to:
          — Go to edit the homepage
          — See which page template it’s running on
          — Find the matching page template by searching through files

          Another method: search around for a plugin that prints which php file is running a particular page. That is, when the plugin is turned on, when you visit any page of your site, it will print which files are being used.
          Let me know if this helps.

  • Cinco

    Sweeet – trying to create a customised blog page, really help – thanks

  • Rahul R

    Did everything you said and got it WORKING!, BUT

    At the starting of this tutorial you said “You probably want to only add certain posts to certain pages, and you want a way to specify which posts goes on which pages.”

    And this is my problem. I need this technique for my web portfolio where I can create client wise pages showing all categories of services I did for them (posting different services using your technique) and also want to show works in category wise.

    Now all the posts I add, is coming under the page I created even I meant to post a work that should come under another client page. its happening just because its under the category I had created as you said.

    I want to decide which posts would should be shown in a particular page.

    Can I expect your help bro?

    • Arsham Mirshah

      In this model, the only way to decide which posts hit which pages is by grouping them in categories.

      If you want multiple categories to come up on 1 page, you’d simply copy & paste the code that pulls a particular category and change the category number.

      But really, it sounds like you want to control which posts show up on which pages more explicitly than just via category groupings… In which case, you’re looking at some custom development.

      Without fully understanding your case, I would think something like the “advanced custom fields” plugin is needed.. that plus some custom template development will provide your solution.

      Sorry if that wasn’t helpful.. maybe if I better understood your situation..

      Either way, let me know what happens & best of luck!

  • Yves Gallego

    First THANKS A LOT for that great Tuto !!!
    Everything works fine as in your example !
    However, I would bring up the date and time next to the title of the article content on the page … Is it possible? if so, how to please?

  • Michal

    Thank you very much, I was thinking about this way of solving the problem, but I am not php savvy and you saved my day:) I really do not know why this is not natively in WP software. I am new to WP and last few days I have spent cursing myself for not being able to solve it, then I realized.. Why on earth is there only one “posts” page, while you can create as many static pages as you wish? (I know, it is blog..but still WP has certainly more aspirations than to be simple “post after post after post” cms) It seem to me to be the main obstacle when creating a website with more traditional structure in mind – most people want their content nicely divided from the beginning. Handling it using categories is not so good, when you do not have all kinds of content, but few.

    • Arsham Mirshah

      Hey, glad this helped! Let me know what other challenges you’re facing because chances are others are facing the same challenges and I’d be happy to write up a how-to tutorial type article to help.

      PS: Don’t be shy to tweet or like our facebook page :)

  • You Need

    Hi Arsham Great tutorial helped me and easy to do it
    Just a one Question Please
    if i want to make more categories which allows me to make my posts appears on different pages on my website do I have to do the same create a page with the index.php code and paste the

    above …. ?

    • Arsham Mirshah

      Thank you. Yes, with this model, you would have to create a new template file for each category of posts that you want to pull onto the page.

      Let me know if that helps.

      • You Need

        Thank You Very Much Arsham Works like a charm thank you again (:

        • Arsham Mirshah

          Sweeeet! Happy to hear that Zak!

  • sam

    Hi, this has helped me a lot but I run into a small problem. I would like to have the posts on a static front page just 2 posts which is fine but the are not appearing on the page but just dropping below with the normal sequence of posts. How can this be avoided?

    • Arsham Mirshah

      The template file that’s running your front page must have a WordPress “loop” running above your code which is outputting all those posts.

      You can try either removing that code.. OR, probably better yet…

      From the WordPress admin backend, go to Settings -> Reading and switch the “Front page displays” settings :)

      • sam


        Thanks for your reply. Front page displays is not doing anything removing yes but then I end up with only 2 posts so I suppose I have to call then then the rest of the posts which i would like to show on the front page? Will I not have any trouble down the road since I will be having an empty page.php? Sorry to ask so much but I have been struggling for 2 days with this lol you are my savior…

        • Arsham Mirshah

          Well I wish I could help, but without understanding your specific situation and seeing your code, it’s going to be hard for me to help.

          I might suggest looking around for a plugin that might help you accomplish what you’re trying to do.

          OR – if you have the funds, finding a WordPress developerwho can help you.

  • Adam Gorecki

    Thanks Arsham. This is a great tutorial for a beginner like me. I have spent two days trying to solve this problem, but your’s was the best solution.

    I am wondering if there is a way to show each post in a different “box” (similar to the default blog page). I am assuming it is some CSS. What code would I use to be able to do this?

    My other issue is that there is no place for people to comment on the individual posts. However, when I click on the post name, it brings me to a page where comments are allowed. It seems as though the template created by your tutorial just does not allow for comments on the individual posts. Any advice?

    • Arsham Mirshah

      Thanks for the kind words.

      Yup, you will need some CSS love to make the different boxes happen. Shouldn’t be too bad :)

      You might be able to do a comment template in the loop that puts the posts onto the page:

      Hope this helps

  • Stephane Roch

    Hi, I downloaded your pluging and it does exactly what I want. Thank you. I spotted that there is no space between the post-ID and the “Read more…” text. I found where to fix it if you want to include in your next revision:



    $html .= ”;

    $html .= ‘ID) . ‘”>’;
    //change is below added space.
    $html .= ‘ ‘ . $dataFlags[“text_readmore”];
    // end of change
    $html .= ‘

    $html .= ” . PHP_EOL;


    • Arsham Mirshah


  • Jason Mills

    Thanks so much for this, it really was the clearest solution I’ve found.
    I was able to make the page and populate it with the right posts, but…

    All the posts are lined up right against the left edge of the page. Is there a way to move everything over?

    • Arsham Mirshah

      Jason, thanks for the kind words..

      Do you know CSS at all? You could wrap the posts in a , give it a class, and set that class to have a margin-left of 20px.

      Try this:

      Put ” before the code block (before “global $more”)
      Put ” at the end of the code block (after “wp_reset_query()”)

      Let me know if that helps :)

  • aamirf

    Hi i have a page and i want to show some other pages inside it, how do i do that ……. ?

    • Arsham Mirshah

      Do you want to show the ENTIRE page .. or JUST the contents of the page.
      That is, you don’t want to use an iFrame, which will show the header and footer of the second page inside the first, correct? You rather just show the CONTENT (that which you enter into the “content” box of that page), correct?

  • ken

    it all makes sense now, thanks for the simplification

  • sxu888

    I have used the short code and post appeared on my static page as bullet point list. Is there any way I can have the posts showing as images without going through the story template process? for now? I have tried the story template but the site was broken.

    • Arsham Mirshah

      Are you looking to use the post thumbnail instead of bullet points?

  • Arsham Mirshah

    This feature is now available through the add posts to pages plugin

  • ekta

    index.php file is blank under the theme folder…..then what to do???after that i tried plugin ….even though not working

    • Arsham Mirshah

      If the plugin isn’t working, it’s likely an issue with your theme :( Try changing to the default theme and trying again.

  • rockydude

    Hello, this code is only giving me the post title on the page but i would like to add a small summary of the post and then continue more link in the end. blow this i would like to have the dates the article posted on. how is this possible?

    • Arsham Mirshah

      Download the plugin and try that.
      It won’t have dates, but you can the excerpt and more link :)

      • Johannes Kvamme

        Thanks! This fixed my problem. However, the posts is being displayed in their full length.

        This is what I’ve put into my page:
        [add_posts category=konfirmantnytt show=5 h=2 readmore="Les mer" img=false]

        Any understanding and help? Why are they in their full length?

        • Arsham Mirshah

          Johannes, I believe they are at their full length because you have not set the “read more” break point.

          Please refer to this page: to set the read more break point.

          Hope this helps!

        • Arsham Mirshah

          If you have a “read more” link then it assumes you want a full .. remove the “read more” and see what happens.

  • Helle Flindt-Rasmussen

    Hey Arsham, Thank you so much for this tutorial! I have been going out of my mind trying to figure out at way to do this – and there it was! Everything is working successfully, BUT I only see the headlines of the posts. I did everything right, but I can’t seem to figure out how to make it work so that – if not the whole post. then a good part of it – is showing.
    I am using a child theme of Twenty Fourteen

    Where to and how to make changes??!!
    I really hope you will help me, thank you so much!
    AND: do I need to put anything on the page, that shows the posts, fx [ add_posts category=nyheder tag=nyheder show=5 h=2 full=true readmore=false img=true] (without the extra space added ;-) )

  • Andreas Saarem

    Hi, I’ve been struggeling with the coding up here. I managed to do new custon template which is also shoving in templates dropdown, but I cant make it exactly same style as the rest of my pages. It’s totally blank and my page.php copy-paste gives error.

    Anyone knows what could go wrong when copying page.php to new template?

    • Arsham Mirshah

      Yes sir.. you want to change the name of the file (obviously). Then you want to make sure to name the template (at the top of the file with PHP comments):

      Template Name: My Custom Page

      Otherwise, try my plugin .. it might be easier:

  • Arsham Mirshah
  • Colin

    Hey thanks for the tutorial it’s exactly what Im looking for but when I paste the code you wrote it’s all broken and sending errors in my IDE, any idea?


  • Colin

    Hey the Plugin is great! Thanks for that, although I pasted this shortcode in the pages visual editor and no posts are showing up still

    [add_posts category=love tag=love show=5 h=2 full=false readmore=”Read more link text” img=true]

    Any thoughts? Is there something Im missing? Do I need to put it somewhere specific?

    Thanks again

    • Arsham Mirshah

      Hi Colin, it’s possible that your posts are not both categorized and tagged “love”.

      Try removing parameters from the shortcode and seeing if that helps (for instance, remove “full=false”)

      • Colin

        Is there a parameter that allows it show the category and date on the front end? Or a way to do that?

        • Arsham Mirshah

          Unfortunately, not yet.

          • Colin

            That’s a bummer. Am I able to contact you personally to get some insight on how to incorporate that? I’ve been messing around with add-posts-to-pages/index.php trying to pull and display the category for each post, and so far only get (array) showing on the front end.

          • Arsham Mirshah

            I’m sorry Colin, it’s not going to be easy to coordinate this.
            If you give us a mockup of what you’re looking to do, we might be able to scope it for you.

  • Dimi

    I am getting a syntax error Parse error: syntax error, unexpected ‘>’ in /home1/withittech/public_html/wp-content/themes/PinThis/page-stories.php on line 39

    Line 39 is line two from your code: < ? p h p

    Any ideaS?

  • Jesse Vanderwerf

    Just wanted to say thanks for the post. Still trying out your code. Looks like there was an error with the code posted. I think you were missing an opening single quote. Towards the bottom third of the code. Hope that helps. See code below.

    global $more;
    $more = 0;
    if(have_posts()) : while(have_posts()) : the_post();
    <a href=&quot;&quot;><?php the_title( '
    ‘, (here is where I put a single quote)
    ‘ ); ?>

    • Arsham Mirshah

      Thank you Jesse.. we’ll get it fixed.

  • Jesse Vanderwerf

    So I was able to fix the code posted.

    If anyone needs this I would try this code:


    print '’;

    global $more;

    print ”;

    $more = 0;

    print ”;


    print ”;

    if(have_posts()) : while(have_posts()) : the_post();

    print ”;


    <a href=&quot;&quot;><?php the_title( '

    ‘, ‘

    ‘ ); ?>


    print '’;


    print ”;


    print ”;


    print ”;


  • awais

    helo i got to know about page.php(in theme->editor) but what is that page-stories.php(how to create it)

  • Arsham Mirshah

    page-stories.php is just an example to show the new page template that you need to create in order to add posts to a certain page in WordPress.