• I use WP as a backend publishing tool, and use the following code to include a post and/or category in a series of PHP templates:

    <?php
    ini_set (user_agent, "blah");ini_set (default_socket_timeout, "5");
    error_reporting(0);
    $theurl="https://www.theurl.com/blog/2007/11/02/the-post-or-category-slug/";
    $filestring=file_get_contents("$theurl");
    echo "$filestring";
    ?>

    You can see this working here: https://test.naturopathy-uk.com/home/main/ – each area on the page calls a different post or category of posts.

    This works just fine, but it’s creating a real load on Apache server, especially when there are several instances of this call to include content from WP, as is most always the case. I can’t use a simple:

    <?php include(); ?>

    as my host says no, security-wise. Does anyone have any suggestions regarding this? Can the Loop be used to include multiple instances of specific posts and/or categories in the same page and, if so, would this be just as much of a resource hog as what I’m doing here?

    I should mention that the WP install sits in the directory as above i.e. https://www.theurl.com/blog/.

    Many thanks for any help, looking for a more elegant way of doing this.

    Best,

    – Rob

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Using WP as a CMS question’ is closed to new replies.