Getting Short Code to with get_page function
-
Hello,
I created a page called “About Us” that is also used for the home page intro text with post Loop.The reason for this is so the intro content can be edited via the WP admin.
I used the following code to include it on the home page:
<?php
$page_id = 2;
$page_data = get_page( $page_id );
$content = $page_data->post_content;
echo $page_data->post_content;
?>Everything works as intended except for the gallery short code:
[gallery link="file"]
On the “About Us” page it renders the gallery as intended. See
https://leadershipsports.com/wordpress/?page_id=2
However on the home page, it does not render the gallery but renders the short code text “[gallery link="file"]” See
https://leadershipsports.com/wordpress/
Any suggestions on how to get WP to render it properly in the home page?
Thanks.
- The topic ‘Getting Short Code to with get_page function’ is closed to new replies.