Add a specific page or post content in another post or page

Note : the following code snippet requires advanced WordPress developer skills. There's no guarantee that this snippet works as is with the latest version of our themes, and with the latest version of WordPress. That's why you need to always test any code snippets in a staging environment before implementing it in a production site.

Following this discussion in the Customizr theme support forum, here’s a simple piece of code that will allow you to add any post or page before your post or page content in the Customizr WordPress theme.

The following snippet will add the content on your front page and before the featured pages.

You can change the condition ( ! tc__f(‘is_home’) ) and the hook to target a new context and a new location in any pages/posts/archives.


Additional resources :

Related Snippets you may also like

16 thoughts on “Add a specific page or post content in another post or page

  • Alhamdi Ahzan

    Sorry, I’m new with WordPress, but can someone explain how to use this? I have multiple pages, and I wanna post something in one of my specific pages (based on specific category). But I still want my homepage show all of my post regardless which category it is, just like news feed. Thanks

  • Dave

    Hi, thanks for these helpful snippets! However, I created a page with ‘Page Builder by SiteOrigin’ and tried to use this method to place it on the front page. Unfortunately all of the CSS formatting from the gets removed when it is displayed. Does anyone know how to stop this happening? Thanks

  • Ashley

    I used the above snippet to move the content of the page above the feature pages… but now I want to remove it from below the feature pages (because it’s now showing twice on the page)… what do i add to remove it from below?

  • Claudio

    Hi Nicolas
    I hava a question:
    I need to have the last posts on the home page but I also need to have a page called “news” that display the last posts.
    In WordPress if I select “Your latest posts ” in Front page displays setting than I cannot assign a page for last posts.
    how can I do that?
    Thanks very much

  • Kade

    Nicolas, firstly thanks for such an awesome theme is one of the best I have come by!! 🙂

    I have been searching round the code snippets and hooks on here and am having trouble finding specifically what I need…

    Could this snippet be modified to allow me to do the following.. (or would there be a better one for it?)

    I have previously used custom page templates with ‘query_posts’ (

    ) to allow me to have a page with its standard content showing first, and under that shows all full posts from ‘Category A’ if the page title is ‘Category A’

    Hopefully that makes sense, and hopefully you can assist. Regards Kade.

    • Kade

      (Sorry code snippet messed up) what it should have said in it was “query_posts(‘category_name=’.get_the_title().’&post_status=publish’);”

    • Nicolas Post author

      Hi Kade, that makes perfectly sense to me 🙂

      I would hook a callback function on the “__after_main_container” action hook.
      The callback function could for example use the get_queried_object() wp function to get the current post categorie(s).
      Then, once you have the categories, you could retrieve the post lists using the get_posts() wp function with the categories as arguments, and loop on this posts list to display the HTML markup.
      Note :
      1) pages can’t be assigned to a taxonomy (category or tag) in WordPress, I think you are talking about posts.
      2) query_posts() should never be used in WordPress. It creates additional queries and can lead to serious inconsistencies (widget bugs for examples) throughout your website.

      Hope this helps!

  • k l

    Hello, I would like to add specific page to specific category instead of front page, is there a hook for that purpose? Thanks in advance!

  • Simon

    Thanks for this snippet, it’s almost exactly what I’m looking for.
    Is there a way to hook featured pages to a specific spot in the middle of the static front page? Or maybe somehow break a page in two and hook it before and then the second part after FP?

    • Simon

      I figured it out, it took me a while to realize I can add custom page with above code and use the built in settings to have a static page under the featured area.
      Thanks for such a nice and customizable theme 🙂

Comments are closed.