WordPress.org

Forums

get_page() not working with plugins? (2 posts)

  1. armored
    Member
    Posted 5 years ago #

    Hey,

    I tend to believe that it's me doing things wrong but do the plug-ins stop working when I use get_page() instead of the_post() to retrieve page content?

    I have a Contact Form 7 form on my page inserted like this:

    [contact-form 1 "Contact form 1"]

    Now, in my page.php I have the following code to retrieve the page content:

    <?php
     $page_content = get_page($page->ID);
     echo $page_content->post_content;
    ?>

    The $page->ID is set alright as the page content itself is coming down fine. It's just the form plug-in that does not get "translated" and displays like [contact-form 1 "Contact form 1"].

    Any idea how to solve this?

    Many thanks in advance!

  2. armored
    Member
    Posted 5 years ago #

    For those interested, I found the following the solution:

    <?php
     $page_content = get_page($page->ID);
     echo do_shortcode($page_content->post_content);
    ?>

    Basically, I've aditionally fed the retrieved page content through the do_shortcode function.

Topic Closed

This topic has been closed to new replies.

About this Topic