Bloggeries

Go Back   Blog Forum - Bloggeries > Blogging Tools and Resources > Tech Talk

Tech Talk Get help with the technical side of blogging. Discuss blog customisation, plugins and widgets.

Learn how to set up a blog, start blogging, produce quality content and use these forums as your internet marketing courses.

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old October 16th, 2009, 12:20 PM
Not Yet Approved
 
Join Date: Oct 2009
Posts: 3
iTrader: (0)
jennypretty is on a distinguished road
Default How to create a file to list 5 newest posts

Hello,
I have a wp blog located under domainname.com/blog/, I like to create a file to list 5 newest posts (title + first 100 characters of the post description) on my homepage domainname.com.
I use PHP on my homepage, so I will include this file on my homepage to show 5 newest posts. On the blog,
Can someone please help me to create a file to list 5 newest posts with first 100 characters of the post description?
I appreciated your help.
Thanks very much and have a nice day.
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote

Don't Like Ads?? Register as a Member and These Ads Will Disappear!

-->
  #2  
Old October 16th, 2009, 07:25 PM
Nathan's Avatar
Resident Experiment Inventor
Administrator
 
Join Date: Mar 2008
Location: USA
Posts: 2,392
iTrader: (0)
Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of
Default Re: How to create a file to list 5 newest posts

Why don't you use an RSS feed plugin to use your RSS feed which is basically a file just like that?

That is what RSS is for, so it should be fairly easy.

You might use this:

RSS Reader - PHP script for displaying an RSS feed on a web page

Your WordPress blog already has a builtin feed.
__________________
+ Experiment Garden is my current blog for experiments and my project portfolio.
+ My first blog was Inkweaver Review. Now I work on Bookflavor

+ You should try out Duck Duck Go
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #3  
Old October 20th, 2009, 07:51 AM
Not Yet Approved
 
Join Date: Oct 2009
Posts: 3
iTrader: (0)
jennypretty is on a distinguished road
Default Re: How to create a file to list 5 newest posts

The reason I like to create a file to store 5 newest posts is because I want to include this file on my homepage. I like the homepage to display 5 newest posts automatically. My blog is at blog/ folder.
thanks.
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #4  
Old October 20th, 2009, 12:50 PM
Nathan's Avatar
Resident Experiment Inventor
Administrator
 
Join Date: Mar 2008
Location: USA
Posts: 2,392
iTrader: (0)
Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of
Default Re: How to create a file to list 5 newest posts

Right, but if you blog is WordPress it already has that file. It's called something like http://yourdomain/blog/?feed=rss2

You just need to use the PHP reader I told you about to open that file and display the latest five results on your main page. That is the only way I can think of to do what you are trying to do.
__________________
+ Experiment Garden is my current blog for experiments and my project portfolio.
+ My first blog was Inkweaver Review. Now I work on Bookflavor

+ You should try out Duck Duck Go
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #5  
Old October 22nd, 2009, 09:14 AM
Not Yet Approved
 
Join Date: Oct 2009
Posts: 3
iTrader: (0)
jennypretty is on a distinguished road
Default Re: How to create a file to list 5 newest posts

When I open this file to modify it, there is no code in there. How do I get the completed file to modify it?

<?php
/**
* Redirects to the RSS feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rss_url' ), 301 );
?>

thanks.l
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #6  
Old October 22nd, 2009, 12:31 PM
Michigal's Avatar
Blogger Supreme
 
Join Date: Jul 2008
Location: Midcoast Maine
Posts: 122
iTrader: (0)
Michigal is a splendid one to behold Michigal is a splendid one to behold Michigal is a splendid one to behold Michigal is a splendid one to behold Michigal is a splendid one to behold Michigal is a splendid one to behold Michigal is a splendid one to behold
Default Re: How to create a file to list 5 newest posts

Jennypretty,

Are you wanting to show this in the sidebar? Or do you mean you want excerpts of the last five posts on your home page?
__________________
Sue
Lighthouse News
Follow me on Twitter
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #7  
Old October 22nd, 2009, 01:06 PM
Nathan's Avatar
Resident Experiment Inventor
Administrator
 
Join Date: Mar 2008
Location: USA
Posts: 2,392
iTrader: (0)
Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of
Default Re: How to create a file to list 5 newest posts

Quote:
Originally Posted by jennypretty View Post
When I open this file to modify it, there is no code in there. How do I get the completed file to modify it?

<?php
/**
* Redirects to the RSS feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rss_url' ), 301 );
?>

thanks.l
Right.... you don't open the file directly and copy its contents to the main page. That is why you use the PHP reader code that I told you about.

If you open the file with a plain text editor you aren't going to see anything because that file is generated automatically based on the content of your posts. It is generated when it is requested.

So the PHP reader code that I gave you a link to earlier requests the feed, WordPress generates the file based on the content of the recent five posts, then the reader can be used to print out the results on your main page.

It is slightly technical. Do you know PHP? If not I can help you with it some but I am very busy at the moment. lLt me know, though, if you need help with this.
__________________
+ Experiment Garden is my current blog for experiments and my project portfolio.
+ My first blog was Inkweaver Review. Now I work on Bookflavor

+ You should try out Duck Duck Go
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #8  
Old October 22nd, 2009, 01:09 PM
Nathan's Avatar
Resident Experiment Inventor
Administrator
 
Join Date: Mar 2008
Location: USA
Posts: 2,392
iTrader: (0)
Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of Nathan has much to be proud of
Default Re: How to create a file to list 5 newest posts

Actually why don't I go ahead and do this for you:

PHP Code:
<?php

include "rsslib.php";

RSS_Display("Replace this with the URL of your blog's feed.",5);

?>
Put the above code into the code for your main page where you want the latest five posts to appear. Note that you will have to download:

http://www.scriptol.com/rss/rsslib.txt

Save all that text as a file named rsslib.php in the same directory as the file that you want the latest five post listing in.
__________________
+ Experiment Garden is my current blog for experiments and my project portfolio.
+ My first blog was Inkweaver Review. Now I work on Bookflavor

+ You should try out Duck Duck Go
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
  #9  
Old October 22nd, 2009, 01:24 PM
Blogger in Training
 
Join Date: Oct 2009
Location: Scotland
Posts: 15
iTrader: (0)
rcraig12 is on a distinguished road
Default Re: How to create a file to list 5 newest posts

I never thought of doing it that way. Thats really light wieght as the database doe not need to take a hit when creating the data for the plugin/widget.

thanks alot for that
Digg this Post!Add Post to del.icio.usReddit! Stumble this Post!Twit this!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:10 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 RC1

Blog Directory | Submit Blog | Latest Blogs | Blogging Blog | Blog Reviews | Blog Forum