/ Published in: PHP
URL: http://mpme.tumblr.com/post/2660646773/wordpress-get-content-from-separate-page
Working with Wordpress 3.04, pretty URLs in permalink settings must be enabled.
Allows you to get content from a different wordpress page. If you liked this, please like my facebook page http://bit.ly/manocreativeinc
Expand |
Embed | Plain Text
<?php //PERFORMS MYSQL QUERY TO GET THE POST ID //note: 'about' is the name of the page, you can use any named, ex: 'web services' $about_page_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = 'about'"); $post_id = get_post($about_id); $content = $post_id->post_content; //applies wordpress filter (includes <p> tags) $content = apply_filters('the_content', $content); echo $content; ?>
You need to login to post a comment.
