Home »
Imported messages »
comp.lang.php »
I want to read Wordpress blog
Re: I want to read Wordpress blog [message #175467 is a reply to message #175459] |
Thu, 29 September 2011 22:40 |
Mike S
Messages: 8 Registered: September 2010
Karma:
|
Junior Member |
|
|
On 9/29/2011 4:19 AM, youdol testAcount wrote:
> Hi,
> I am developing an application in PHP similar to wordpress or blogger.
> I want to import blog of particular user and embed those post to my
> database.
> It is similar functionality as wordpress is giving for importing other
> blogs.
> I have been through many documentation provided by wordpress.org ->
> Codex, From my application user gives his/her wordpress blog URL , and
> password but I am stuck in reading wordpress blog of a user.
> I am new to this kind of development, I am sorry for my limited
> knowledge.
> Any response is highly encouraged and appreciated
> Thanks
I'm not sure if this is exactly what you're looking for but I grab
recent posts from multiple blogs and display them on a "front intro
page". The "intro" page and all of the blogs are are on the same server,
you will need permission to post a file on each blog you want to pull
data from to use this approach.
Save a file with this code in each blog folder (where wp-config.php is
installed), I name it wp-recentposts.php
<?php require_once('wp-blog-header.php');
$posts = get_posts('numberposts=5&order=DESC&orderby=post_date');
foreach ($posts as $post) : start_wp(); ?>
<a href="<?php the_permalink() ?>" target='_blank'><?php the_title();
?></a><br>
<?php endforeach; ?>
Change the number of posts displayed, sorting, etc. to whatever you want.
Then read this file into your external page. If you are displaying
recent posts from multiple blogs on the same page you may need to use a
iframes, that was the only way I could get the code to work for multiple
blogs:
<iframe src=".../wp-recentposts.php"></iframe>
I didn't want to use an iframe (I avoid them unless they're absolutely
necessary) but I couldn't find any other way to get this approach to
work for multiple blogs: the data from the first blog was repeated for
all of the other blogs when I didn't use iframes. I was able to display
recent posts from a single blog without the iframe.
I got the code from these pages:
http://wordpress.org/support/topic/show-latest-posts-with-get_posts-not-wor king
http://codex.wordpress.org/Template_Tags/get_posts
http://wordpress.org/support/topic/posting-recent-posts-with-dates
http://wordpress.org/support/topic/display-latest-10-posts-from-specific-ca tegory
http://css-tricks.com/forums/discussion/2293/wordpress-plugins-that-show-re cent-posts-on-sidebars/p1
Mike
|
|
|
Goto Forum:
Current Time: Tue Nov 26 18:45:38 GMT 2024
Total time taken to generate the page: 0.04853 seconds