WordPress.org

Ready to get started?Download WordPress

Forums

Latest Post on homepage (14 posts)

  1. Rangers4me
    Member
    Posted 9 years ago #

    I just started a website for my productions company, GurwinProductions.com. In the lower left hand corner i want my latest blog post to come up from my blog, (Gurwinproductions.com/blog), right now i have to do it manually. I want to be able to have it automatically update, when i update the blog.

    Any suggestions?

    I tried using rss php parser, and rss to javascript parser, but they didn't work.

  2. Kafkaesqui

    Posted 9 years ago #

    If your home document is a PHP file (i.e. index.php), you could include the wp-blog-header.php file from your blog's directory, like so:

    <?php require('./blog/wp-blog-header.php'); ?>

    Once this is *available* in the file, you have access to all WordPress features, such as The Loop. To display the last post only, initialize your Loop with by adding this just before it:

    <?php query_posts('showposts=1'); ?>

    More info on query_posts():

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

  3. tomhanna
    Member
    Posted 9 years ago #

    Why didn't they? What errors did they give? Be sure to leave the "feed:" out of the feed url. The correct url to your feed is http://www.gurwinproductions.com/blog/?feed=rss2

  4. Rangers4me
    Member
    Posted 9 years ago #

    Thanks, the change in url made java script one work, but php rss parser still does not work. When I put the script in dreamweaver then preview it in a browser, the following outputs.

    0) { for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) { if (isset($rss_channel["ITEMS"][$i]["LINK"])) { print ("\n
    " . $rss_channel["ITEMS"][$i]["TITLE"] . "
    "); } else { print ("\n
    " . $rss_channel["ITEMS"][$i]["TITLE"] . "
    "); } print ("
    " . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "

    "); } } else { print ("There are no articles in this feed."); } } print ("Free PHP RSS Parser - RSS Newsfeed Hosting"); ?>

  5. vkaryl
    Member
    Posted 9 years ago #

    You could try CG-feedread from http://www.chait.net/index.php?p=238

  6. Rangers4me
    Member
    Posted 9 years ago #

    I couldn't get CG-feedread working. Is there anyone here, if I send you my .html file, willing to try to get the blog part working on the homepage?

    Thanks very much!

  7. tomhanna
    Member
    Posted 9 years ago #

    The php parser isn't going to work on a page that has .html extension because your server isn't going to parse the php in any page without the .php extension. Try renaming your index.html to index.php and see if it works.

  8. Rangers4me
    Member
    Posted 9 years ago #

    I tried changing the page to .php, but when i load the page (http://www.gurwinproductions.com/index4.php), i get Parse error: parse error, unexpected T_STRING in /home/.mahaut/gurwin/gurwinproductions.com/index4.php on line 185.

  9. Rangers4me
    Member
    Posted 9 years ago #

    I tried changing the page to .php, but when i load the page (http://www.gurwinproductions.com/index4.php), i get Parse error: parse error, unexpected T_STRING in /home/.mahaut/gurwin/gurwinproductions.com/index4.php on line 185.

  10. tomhanna
    Member
    Posted 9 years ago #

    Hmm...You might (and I'm not at all sure) be able to do a php page and call the html page as an include. Like this:

    <?php include ('index.html'); ?>

    I'm not sure how well that will work or if it will solve the unexpected T_STRING error. That unexpected T_STRING error I've usually seen when single quotes were used where double quotes were needed or vice versa, but with the code you have on your page there isn't even a line 185, so it is probably in your RSS parser. If there are single quotes around something (like the feed URL) try changing them to double quotes.

  11. Rangers4me
    Member
    Posted 9 years ago #

    I tried adding double quotes, and the error now comes up on line 85 (where the change was made).

  12. tomhanna
    Member
    Posted 9 years ago #

    Well, then I guess it was the other way around - change those back to single quotes and then go to line 185 and see what's there.

  13. Rangers4me
    Member
    Posted 9 years ago #

    I took out what was on line 185, the page kind of loads, but their is a new php error listed.

    (http://www.gurwinproductions.com/index4.php), Warning: fopen(): URL file-access is disabled in the server configuration in /home/.mahaut/gurwin/gurwinproductions.com/index4.php on line 156

    Warning: fopen(http://www.gurwinproductions.com/blog/?feed=rss2): failed to open stream: no suitable wrapper could be found in /home/.mahaut/gurwin/gurwinproductions.com/index4.php on line 156
    could not open XML input

  14. Rangers4me
    Member
    Posted 9 years ago #

    bump...any suggestions?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.