Load dynamic content in a wordpress website

is there a way to load a page content ( or an element ) from a page into another one on a same Wordpress website? For example, if I had a page with some links would it be possible to make a specific element ( such as a div ), that comes from an another page, appear in a specific part of the page? If it was possible, can anyone help me reaching out the best way to do it ( which language use and in which way use it ) ? I hope someone could help me, thanks.

Topic custom-content Wordpress

Category Web


If you wanna call content of one page to another page then for that you need to make custom template.

For example if you have 2 pages (page a and page b) then make template for page a. And now you want to add content of page b into page a, this can be done with following code

$include = get_pages('include=10'); //Assigning ID of page
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;

In the above code code I have assign ID 10 to get_pages() function, just for demo purpose. Replace 10 with your actual page ID whose content you want to show in page a.

Just Paste the above code in custom template (made for page a) on location of your choice and page b content will get appear on that location.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.