How to pull "most recent post" data from a Wordpress blog? - php

I have two Wordpress blogs. I want to pull the "5 most recent posts" from the first blog with post title, date, and link to post and display this data on the other. I don't know if there is a plugin that does this sort of thing already, but just wondering how I can achieve this.

What you need to use here is an RSS from the first blog and display it using a plugin or something you'd code yourself on the 2nd blog. The reasons for this approach are:
simplicity of implementation
security - functions that pull data from the database in blog 1 are not available to blog 2 (db settings, etc). I'm not sure if wordpress provides some sort of an oAuth API yet to pull this data in a secure way
Something like KB Advanced RSS Widget should do for your case.

This also somewhat depends on where you want the posts from "Blog 2" to display on "Blog 1". For instance, if you want them to display in the sidebar and your theme supports widgets, then WordPress has a built-in RSS widget. You just need to give it the RSS feed for Blog 2. That would probably be the simplest implementation.
Otherwise a plugin of some sort to grab the feed would probably work well, as Artem suggested.

Yes RSS would probably be the best way to do it. Here's a post that goes over a variety of ways to do it.
http://www.tipandtrick.net/2008/how-to-fetch-and-show-rss-feeds-on-wordpress-blog-atomrss-aggregator-plugins/

Related

Pull content from a remote WordPress install

I need to create a wp widget that automatically pulls data from another wordpress install on a remote server.
Basically, the source site is a review site where offers vary over time. My widget will pull certain offers and make sure they stay updated.
Reviews on the source site are custom post types with custom meta fields that need to be fetched (price, offer, etc).
Looking around I've seen different suggestions: query the remote db, fetch the feed (does it store custom meta fields?), use json (which I barely know what is, but I am willing to learn new stuff).
What is the best method for my purpose and where can I find resources to help me achieving my goal?
Thanks for your help!
WordPress allows you to have an RSS feed per custom post type which is handy. Then you can make use of the WordPress Fetch Feed function to scoop what you need!
Are you the creator of the remote website?
You can create a new template in your theme
Code what you want to display in the format you want to display it
(json or just a bit of html)
In your wordpress admin create a new page and assign the new template
to it.
In your new site you just have to fetch the page

Parameter for more than 10 posts in WordPress RSS

I need to generate an RSS feed for posts in WordPress that contains more than the usual 10-or-so items. I understand that somewhere I need to do something such as query_posts( 'posts_per_page=-1' );, but I have absolutely no idea where. (I am new to WordPress development.)
I've looked all up and down my includes/feed-rss2.php, and while I see a lot of stuff that generates my feed, nowhere do I see something that actually queries for a list of posts. In fact, there is no reference to "query" anywhere in the file!
Can you direct me to the appropriate place? Better yet, if there is some parameter I can stick in the URL when requesting the feed in the first place, that would be great.
Thanks for any direction you can give.
The simplest way to change the number of posts in your feed is to utilize built in options.
Go to the admin Dashboard, then to Settings, then to Reading.
You will be faced with various options, the most important being:
Syndication feeds show the most recent 10 items
That will allow you to specify the number of posts your feed will contain.
Simple, easy and all via the admin panel!
Source: Settings -> Reading via the Wordpress Codex

I want to start a site that syndicates other news. Which CMS is most appropriate

Heres what I am trying to to:
I want to create a site which allows me to syndicate news from all over the web. I want this to be able to be categorized and possibly tagged.
The process:
I find an article I like, go to my CMS, and add it to my site. To do this I simply want to add a title of an article, a small description, and possibly and image. Then, categorize it, add some tags to it.. and submit it. Now it would appear on my site.
What do you recommend as the CMS of choice? I am thinking wordpress may do the trick?
Any suggestions?
My choice would CMS-Made Simple .
Yes, wordpress would be the way to go. You can type the articles and categorize/tag them. You can also install plugins which will read through RSS feeds you add to create links to other sources of new automatically.
The plgun in question is : FeedWordpress

Adding custom content to a Wordpress blog

Is there a way in a Wordpress blog to get the admin side of Wordpress to add custom content in the database, that will not be anything related to posts or pages?
It will just be a little bit of info such as date, title, description, and an image that I will use in a specific part of the front page.
Is wordpress too restrictive on this, will I have to use a different CMS?
Edit:
Could Custom Post Types be what I am looking for?
"It will just be a little bit of info such as date, title, description, and an image that I will use in a specific part of the front page."
So, if I am reading this correctly, you want to create a custom post type, which describing what you are saying - "date, title, description, image" - this is basically a post ;)
You can easily hook into the wordpress query object.
E.g.
$args = array(
'post_type'=>'my_special_post',
'posts_per_page'=>8
);
query_posts($args);
The the normal while posts applies. If you don't want it to be in within the post array, then nothing is stopping you from just creating your own queries which is well explained here: http://codex.wordpress.org/Custom_Queries.
I should add creating post types as well - they are easily configured in your functions.php file without need to add a plugin. Unless you want a more managed solution: http://codex.wordpress.org/Post_Types
You should store these values in custom fields.
Recent WP releases fully support custom types: http://codex.wordpress.org/Post_Types#Custom_Types
This allows you to create a new, full-class data type that will have a new menu option below post and page.
Also, take a look at the More Types plugin (http://wordpress.org/extend/plugins/more-types/), which provides an easy and powerful GUI for doing this. Along with More Fields by the same author (http://wordpress.org/extend/plugins/more-fields/), WP becomes a pretty powerful CMS.

Moving data from custom blog to Wordpress?

Ok so i have this custom blog that i now need to move over to wordpress. I tried using the import features in wordpress but that didnt work as planned. The custom blog is written in php and has a userscomments table, authors table, and posts table. Is there an easy way to move all these posts over to wordpress and preserve all the comments per post.
If the custom blog doesn't have an export function that will dump its data into a format WordPress can read, then it may be that you'll have to roll your own. There are 2 approaches:
Do a database-only import, using code or SQL tools along with information from the WordPress Codex entry on the WP database. This will probably be fairly simple from a coding standpoint, but you have to make sure you get it right.
Use the WordPress API to create the posts based on the output from the old system. This will involve a bit more learning, but it's the Right Way™ to do it, and means that you learn the WordPress API rather than the database structure.
If I were doing it myself, I'd choose option #2.

Categories