| |||||||
| 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.
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
|
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. |
Don't Like Ads?? Register as a Member and These Ads Will Disappear!
|
#2
| ||||
| ||||
|
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 |
|
#3
| |||
| |||
|
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. |
|
#4
| ||||
| ||||
|
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 |
|
#5
| |||
| |||
|
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 |
|
#6
| ||||
| ||||
|
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? |
|
#7
| ||||
| ||||
| Quote:
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 |
|
#8
| ||||
| ||||
|
Actually why don't I go ahead and do this for you: PHP Code: 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 |
|
#9
| |||
| |||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |