Wordpress Help - r...
 

Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop

[Closed] Wordpress Help - rss to HTML, php.

12 Posts
3 Users
0 Reactions
109 Views
Posts: 8564
Free Member
Topic starter
 

I have a wordpress site and it genertes a RSS output.

What I want to do is report all [say 5] entries on the blog to a html or php page. I want to maintain the existing site style.

Any thoughts or scripts out there that I can be pointed at.

Ta muchley.


 
Posted : 06/09/2010 6:30 pm
Posts: 0
Free Member
 

this is for a php page...

put this in your header, before any html:[code]
<?php
define('WP_USE_THEMES', false);
require('/home/USERNAME/public_html/PATHTOWORDPRESS/wp-blog-header.php'); //wordpress header location
query_posts('showposts=6'); //how many posts to display on page
?>
[/code]

then...this code where you want the latest posts to appear on your page:
[code]
<?php while (have_posts()): the_post(); ?>
<h4>Latest Blog Post on <?php the_time('jS F') ?></h4>
<p><ahref="<?php the_permalink(); ?>" title="Read full post">
<?php the_title(); ?></p>
<?php /* the_excerpt(__('More...')); */ /*display extract of latest post(s)*/
the_content(); /*display complete latest post(s)*/ ?>
<?php endwhile; ?>

[/code]
uncomment the the_excert part to dislay a post summary or use (as is) with the_content to display full posts
also add a space between ahref to give a href above stw keeps parsing it and making a link.

hope that helps


 
Posted : 06/09/2010 9:41 pm
Posts: 8564
Free Member
Topic starter
 

Thanks Ciarán

I will try that out later.


 
Posted : 07/09/2010 4:46 pm
Posts: 8564
Free Member
Topic starter
 

Well I created a page with your script.

http://www.black2colour.com/index2.php


 
Posted : 07/09/2010 5:18 pm
Posts: 8564
Free Member
Topic starter
 

Well I created a page with your script. Just what I looking for 🙂

http://www.black2colour.com/index2.php
/p>

How do I stop the code from making the post content be a link ?


 
Posted : 07/09/2010 5:34 pm
Posts: 8564
Free Member
Topic starter
 

Another question. I decided to use the script on another site.... however

My "wp-blog-header.php" is in another directory than the index.php

I keep getting this error 🙁 I think it's something to do with the filepath and no understanding of PHP 🙁

Warning: require(./wp/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/nas03l/z/examplesite.com/user/htdocs/subdirectory1/index.php on line 4

Thoughts anyone 🙂


 
Posted : 07/09/2010 8:39 pm
Posts: 8564
Free Member
Topic starter
 

Another question. I decided to use the script on another site.... however

My "wp-blog-header.php" is in another directory than the index.php

I keep getting this error 🙁 I think it's something to do with the filepath and no understanding of PHP 🙁

Warning: require(./wp/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/nas03l/z/examplesite.com/user/htdocs/subdirectory1/index.php on line 4

Thoughts anyone 🙂


 
Posted : 07/09/2010 8:39 pm
Posts: 0
Free Member
 

Hi

Problem number one - the whole post being made into a hyerlink:
Is happening because there should be a < / a > going in here:
<?php the_title(); ?>[b]< / a >[/b]</p>
remove the spaces in it, STW parses is as html code when i hit Send Post if i dont add them, hence it disappeared in the original post...
That makes just the title of the post into a link.

Problem number two - the failed to open stream warning:
Yeah its is because the filepath in this line is wrong
require('/home/USERNAME/public_html/PATHTOWORDPRESS/wp-blog-header.php');
it has to point to the location of the wp-blog-header.php file relative to your webserver root, so the full fath to it.


 
Posted : 08/09/2010 10:15 am
Posts: 0
Free Member
 

Works a treat that Ciarán. Good stuff.

[url= http://www.stratobiker.com/aaaa.php/ ]Here[/url] - just pulling in three entries. Needs styling.

You must do a lot with Wordpress.

SB


 
Posted : 09/09/2010 7:17 am
Posts: 8564
Free Member
Topic starter
 

Hi Ciarán,

Got the first part working 🙂 Works a treat.

http://www.black2colour.com/index2.php
/p>

PS If you want a black and white photo converted to colour for free please send me an e-mail.

---
Now off to try the second problem. Wish me luck....

***SOLVED IT :-).... fat Fingers on my part in the path .


 
Posted : 10/09/2010 3:47 pm
Posts: 8564
Free Member
Topic starter
 

Quick update .. all works fine.

--

Longshot... can the code be tweaked in any way to show posts from just one category ?


 
Posted : 14/09/2010 2:35 pm
Posts: 0
Free Member
 

Yes...
fairly simple, you just edit this line in your php header before any html:

[code]query_posts('showposts=6'); //how many posts to display on page[/code]

to query the categories also. you can query the categories via the category id or the name, query mutliple categories, and query post NOT in a specific category as follows:
[code]
category_name=black 2 colour //returns posts in category called "black 2 colour "
cat=1 //returns posts in category ID 1
cat=-1 //returns any post NOT in category ID 1
cat=2,6,17 //returns all posts from categories with ID either 2,6,17
[/code]
just use an ampersand to seperate multiple queries (ie how many posts to display and from which categories)
for example:
[code]query_posts('category_name=Uncategorized&showposts=3');[/code]

or
[code]query_posts('cat=1,3,5&showposts=12');[/code]

(you can also query your tags, with the code tag=TAG_NAME for example
[code]query_posts('tag=digital&showposts=6');[/code]
would return the 6 latest posts tagged with 'digital'
...
infact theres a huge amount of queries you can run if you understand a little php, [url= http://codex.wordpress.org/Function_Reference/query_posts ]with guide and examples here[/url])

hope that helps
Ciarán


 
Posted : 14/09/2010 3:27 pm
Posts: 8564
Free Member
Topic starter
 

What can I say. Many thanks.

Off to learn more at the link you suggested.

---

PS Do you a want photograph recoloured... for a all your help 🙂


 
Posted : 14/09/2010 3:52 pm