Forums

'include_path' required for 'include' (5 posts)

  1. bmdavis
    Member
    Posted 1 year ago #

    I have wordpress on a subdirectory and want to reference it on the main page. I do not want to use standard wordpress forms because I want to control it differently than I control the main wordpress directory.

    I tried using an RSSParser in Dreamweaver to reference the website, but the parser wants a .rss file and as near as I can tell, wordpress feeds are .php files. I have used the Dreamweaver function before and it works on .rss, but not on anything else.

    I found another code example that should do exactly what i want it to do: a php line that calls on the following code (through a template)

    <?php
    /*
    Template Name: Latest
    */
    ?>
    <?php
    global $post;
    $myposts = get_posts('numberposts=4&category=8');
    foreach($myposts as $post) :
    setup_postdata($post);
    ?>
    "><?php the_title(); ?>
    <?php endforeach; ?>

    I have the callout code on the main page and the code listed above in the 'themes' of the wordpress folders. I have the following code on the main page:

    <?php
    include("blog/wp-content/themes/mine/latest-post.php");
    ?>
    and it produces the following error:

    Warning: include() [function.include]: Failed opening 'TEMPLATEPATH/blog/wp-content/themes/mine/latest.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.wycliffe/bmdavis/e.ner.gy/blog/wp-content/themes/mine/latest-post.php on line 2

    I need either a solution to the dreamweaver problem or a way to get the include_path right.

    Thanks...

  2. Kafkaesqui
    Moderator
    Posted 1 year ago #

    This:

    <?php
    /*
    Template Name: Latest
    */
    ?>

    says "I am a Page template," which means it would only work as an included document (assigned as a Page's template, that is) within your WordPress blog. To incorporate WordPress functionality *outside* WordPress, you must first include the wp-blog-header.php file, as described here:

    http://codex.wordpress.org/Creating_a_Static_Front_Page#Integrating_WordPress

  3. bmdavis
    Member
    Posted 1 year ago #

    I appreciate the help, it worked. I was able to use the rest of the post you linked to create the links I was looking for from my blog.

    One more question, the code listed on the 'static front page' to create a mini-loop outputs the title of the posts. How do I also grab the date, category/topic, and the first few lines of the post?

  4. Kafkaesqui
    Moderator
    Posted 1 year ago #

    Once you include wp-blog-header.php, you have access to any of WordPress' functionality, including:

    http://codex.wordpress.org/Template_Tags/get_posts
    http://codex.wordpress.org/Template_Tags/query_posts

    There are a number of better and in some cases far easier solutions than the basic query example provided on the Creating a Static Front Page doc.

  5. bmdavis
    Member
    Posted 1 year ago #

    that did it, thanks for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags