How to get page content with template applied?
-
Hello,
I need help with getting the page content with template elements applied.
Lets say i have two pages created: page-1 and page-2.
Now inside page-1 template(php code) I need to query for the content of page-2 with its template applied.
At the moment I’m making cUrl requests by the page guid, but it makes the WP too slow because it is making requests through the internet.
Since I’m not so advances with WP i thought maybe someone can help me with that? Is it even possible?foreach ($pages as $key) { echo get_page_data($key->guid); } function get_page_data($url) { $ch = curl_init(); $timeout = 2; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); return $data; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to get page content with template applied?’ is closed to new replies.