November 19, 2016

PHP script to include page and post using WordPress excerpt

...
Developers are developing the site and it doesn’t matter what technology and platform they are using. but while developing the site sometimes they required to include one page into another page. and you are a developer then must have an idea about it but if you are not a developer then let me give you a short description about include.
Include the name suggest you that it includes something. So in a technical way using include functionality you can show other page content into another page.Suppose I have one page i.e about ultimate blogger and I want to show this content dynamically into another page then I will use include functionality to show it.

In the PHP we are using the following function to include the page.

WordPress is a CMS and many developers has no ideas how to include one page or post into other page using code. In generally we are using readymade plugins and its shortcode to include the pages and post. But sometimes included page will not show the updated content . So, Today I will explain to you how to include page and post into an

...
...
...

So, Today I will explain to you how to include page and post into the other page using WordPress excerpt.Use the following code to do the same.

In the above code replace the $post id with the current page or post id. and $length will be dependent on you choice.

You just need to put above function in the function.php file or anywhere and you need to use following code where you want to show included content.

Make sure that you are using this function and code into PHP files and not in the WordPress default editor.

I hope this will help you a lot while developing the site. Let me know if you any queries related to this.

Related Posts

2 thoughts on “PHP script to include page and post using WordPress excerpt

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons