Go Back   WarriorForum - Internet Marketing Forums > The Warrior Forum > Adsense / PPC / SEO Discussion Forum
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 11-23-2010, 09:44 AM   #1
Advanced Warrior
War Room Member
 
Join Date: Feb 2007
Location: NJ, USA
Posts: 637
Blog Entries: 1
Thanks: 74
Thanked 16 Times in 14 Posts
Default extract titles wordpress

What is the best method to extract the titles of all the posts on a wordpress blog? Is this even possible?

Thanks

Sam

samcarson is offline   Reply With Quote
Old 11-23-2010, 01:54 PM   #2
SEO Strategist
War Room Member
 
yukon's Avatar
 
Join Date: Jun 2010
Posts: 6,532
Thanks: 355
Thanked 1,992 Times in 1,273 Posts
Default Re: extract titles wordpress

Quote:
Originally Posted by samcarson View Post
What is the best method to extract the titles of all the posts on a wordpress blog? Is this even possible?

Thanks

Sam
This code will get you all of your Wordpress Post Titles, as text.

PHP Code:
<?php
require_once('../wp-blog-header.php');
query_posts('&showposts=-1&order=DSC');
while (
have_posts()) : the_post(); ?>
<?php the_title
(); ?>
<br />
<?php endwhile; ?>

yukon is offline   Reply With Quote
Old 11-23-2010, 02:02 PM   #3
SEO Strategist
War Room Member
 
yukon's Avatar
 
Join Date: Jun 2010
Posts: 6,532
Thanks: 355
Thanked 1,992 Times in 1,273 Posts
Default Re: extract titles wordpress

This 2nd code snippet will return all the Wordpress Post Titles (same as above), & also include a clickable hyperlink for each individual Post.
PHP Code:
 
<?php
require_once('../wp-blog-header.php');
query_posts('&showposts=-1&order=DSC');
while (
have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<br />
<?php endwhile; ?>

yukon is offline   Reply With Quote
Old 11-23-2010, 03:54 PM   #4
Advanced Warrior
War Room Member
 
Join Date: Feb 2007
Location: NJ, USA
Posts: 637
Blog Entries: 1
Thanks: 74
Thanked 16 Times in 14 Posts
Default Re: extract titles wordpress

yukon, thanks a lot for that code.

samcarson is offline   Reply With Quote
Old 11-23-2010, 04:19 PM   #5
SEO Strategist
War Room Member
 
yukon's Avatar
 
Join Date: Jun 2010
Posts: 6,532
Thanks: 355
Thanked 1,992 Times in 1,273 Posts
Default Re: extract titles wordpress

Quote:
Originally Posted by samcarson View Post
yukon, thanks a lot for that code.

Anytime.

If you want to reverse the order your Post Titles are displayed, change this.

Quote:
query_posts('&showposts=-1&order=DSC');
To this:

Quote:
query_posts('&showposts=-1&order=ASC');

yukon is offline   Reply With Quote
Old 11-23-2010, 04:49 PM   #6
Advanced Warrior
War Room Member
 
Join Date: Feb 2007
Location: NJ, USA
Posts: 637
Blog Entries: 1
Thanks: 74
Thanked 16 Times in 14 Posts
Default Re: extract titles wordpress

Thanks again.

What if I wanted the titles of all posts on a blog that is not mine? URL is all I have

samcarson is offline   Reply With Quote
Old 11-23-2010, 05:07 PM   #7
SEO Strategist
War Room Member
 
yukon's Avatar
 
Join Date: Jun 2010
Posts: 6,532
Thanks: 355
Thanked 1,992 Times in 1,273 Posts
Default Re: extract titles wordpress

Scraping html from external sites is more involved than the small code snippets above.

This link here might help? I havn't tried the tutorial in the link, still it looks like like it might work.

If you don't have a lot of URLs/Titles, you could always hard code them. You would have to keep the list updated manually.

yukon is offline   Reply With Quote
Old 11-23-2010, 05:19 PM   #8
Advanced Warrior
War Room Member
 
Join Date: Feb 2007
Location: NJ, USA
Posts: 637
Blog Entries: 1
Thanks: 74
Thanked 16 Times in 14 Posts
Default Re: extract titles wordpress

Thanks again. I will try it.

samcarson is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > The Warrior Forum > Adsense / PPC / SEO Discussion Forum

Tags
extract, titles, wordpress

Thread Tools

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 Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 11:23 PM.