Support » Fixing WordPress » Use text from my word press page elsewhere on my website

  • Hi,

    I’m new to Word Press, have read the FAQs, trouble shooting pages and have googled but couldn’t find the answer to what I thought was a simple question:

    I want to include text from my word press ‘page’ elsewhere on my website.

    Here’s a worked example of what I want to do:
    I have created the page ‘about’ in the Word Press dashboard.
    I have webpage about_us.php, and want to include the text from my new Word Press ‘about’ page in about_us.php.
    In this way I’d be using Word Press as a simple CMS where text from my ‘about’ page ends up on about_us.php.

    I just need a point in the right direction.

    Example code for this would be even better!

    I know Word Press has so much more to offer than this simple functionality, but this would be so very useful.

    Thank you for any pointers,
    Paul

Viewing 11 replies - 1 through 11 (of 11 total)
  • P.S. I have installed Word Press 3.0.1 to mydomain.com/cms/

    Are you wanting to have your webserver serve the about_us.php page directly from a URL? If so, that’s not normally how WordPress works; instead you’d add the text from that page into your “About” page using the WordPress admin.

    If instead you are saying you have two WordPress “Pages” at the URLs “/about/” and “/about-us/“, for example, and you want the content entering into the “About” page somewhere on the “About Us” page then what you want is to create a “WordPress Page Template” (google it to learn how) by copying page.php from your theme to another file name (the name about_us.php would be okay) and then insert this code into your theme where you want the text to display:

    <?php
    $page = get_page_by_path('about');
    echo apply_filters('the_content', $page->content);
    ?>

    Hope this helps.

    -Mike

    Hi Mike,

    I’m afraid I’m still a little confused. I have my own, existing web pages, and I want Word Press to supply content for those pages.

    I just want to the text input into word press on these pages. I don’t want an entire ‘word press site’.

    Thanks for any pointers,
    Paul

    That approach is foreign to me so not sure how you’d go about it. I’d try migrating to WordPress if I were you. Sorry, otherwise I can’t really help. 🙁

    Paul,

    Can you please clarify what you’re trying to do?

    And why you’re trying to do it?

    • Do you want an RSS feed from your blog inserted into a page on your Web site?
    • Do you want to copy-and-paste text from your blog posts into a page on your Web site?
    • Do you want to have text automatically transferred from your blog to your Web site?

    Mike

    That approach is foreign to me so not sure how you’d go about it. I’d try migrating to WordPress if I were you. Sorry, otherwise I can’t really help. 🙁

    I do have WordPress?

    Daisy
    I’m simply trying to pull out the text from my word press pages and insert into my already existing website pages automatically. I just want to pull out the text from my WordPress ‘about’ page to my website ‘about us’ page.

    I thought this would be pretty straight forward for something as powerful as WordPress.

    Thank you for any insight out there,
    Paul

    Paul,

    I’m not aware of a way to do what you want automatically.

    I wanted the text from the About page for the blog I created for a friend to appear in a blog post, so I copied the text on the About page and pasted it into the post.

    It didn’t even take a minute for me to accomplish this.

    I’m not looking for a copy and paste solution!

    I would have thought WordPress could do this.

    I guess I try a more traditional CMS.

    Thanks

    Paul,

    Of course you can do it in WordPress. WP is probably the most flexible CMS available. I just did not want to encourage you to use an approach that is anti-thetical to WordPress best practice.

    This following works as a standalone file from the root of your WordPress directory:

    <?php
    include "wp-load.php";
    $page = get_page_by_path('about');
    echo apply_filters('the_content', $page->post_content);

    If your WordPress root is not in the same directory as your about_us.php file then you’ll have to do something like this:

    <?php
    include "/path/to/your/wordpress/root/wp-load.php";
    $page = get_page_by_path('about');
    echo apply_filters('the_content', $page->post_content);

    Hope this helps.

    -Mike
    P.S. And please consider moving your site to WordPress instead of using this approach. You’ll get so many benefits if you do…

    Hi Mike,

    Thank you, that did the trick.

    I’ll certainly be trying out more of word WordPress’ features in future, but this is great addition for a pre-existing site.

    Thanks,
    Paul

    Be sure to check out http://wordpress.stackexchange.com if your future questions go unanswered here.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Use text from my word press page elsewhere on my website’ is closed to new replies.