WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code for posts
Including a PHP file not working (2 posts)

  1. robertallen
    Member
    Posted 1 year ago #

    Hi all,

    I have a very extensive front page, so I wanted to include a PHP file inside a snippet, and put the snippet on the front page, however I keep getting this error...

    Warning: file_get_contents(http://www.singleinstilettos.com/wp-content/themes/singleinstilettos/frontpageblogentries.php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/content/77/8228177/html/wp-content/plugins/php-code-for-posts/PHPPostCode.php(79) : eval()'d code on line 1

    This is my code for the entire PHP file I am including...

    <hr class="blogDivider" />
    
          <div id="front_page_blog_containter">
         <?php
        $args = array( 'numberposts' => 4, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
        $postslist = get_posts( $args );
        foreach ($postslist as $post) : setup_postdata($post); ?>
            <div class="blogTitle"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></div>
            <div class="blogMeta">by <?php the_author() ?> | <a href="<?php the_permalink();?>#comments"><img src="http://www.singleinstilettos.com/wp-content/uploads/icon-comments.png" alt="Comments" align="top" border="0" /> <?php comments_number( 'no responses', 'one response', '% responses' ); ?></a></div>
    
            <div class="blogContentContainer">
            	<div class="blogFeaturedImage"><a href="<?php the_permalink();?>">
    
    			<?php the_post_thumbnail(); ?></a></div>
    
                <div class="blogExcerpt">
    			<?php the_excerpt(__('(more...)')); ?><br />
    
                <div class="blogReadMore"><a href="<?php the_permalink();?>">Read more...</a></div><br />
                </div>
    		</div>
    
            <hr class="blogDivider" />
    <?php endforeach; ?>
    		</div>

    Here is the code in my PHP snippet...

    <?php $front_page_blog_entries = file_get_contents("http://www.singleinstilettos.com/wp-content/themes/singleinstilettos/frontpageblogentries.php");
    echo $front_page_blog_entries; ?>

    I tried just putting the first code inside the PHP code snippet, but it wasn't working properly. I have double checked and made sure my include path was correct.

    Any help would be greatly appreciated.

    http://wordpress.org/extend/plugins/php-code-for-posts/

  2. robertallen
    Member
    Posted 1 year ago #

    Anyone know?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic