Facebook Integration for WordPress

Starting today WordPress publishers can easily integrate Facebook features, such as social publishing and mentions, through the new Facebook for WordPress plugin.

The plugin was built by Facebook engineers in collaboration with open source partners, and makes it simple for anyone to make their WordPress site more social – no coding required. The plugin will also work on mobile and support internationalization.

Social Publishing

Once the plugin is installed, you can cross-post content published to WordPress to your Facebook Timeline and the Facebook Pages you manage. You can also mention the names of Pages and friends as you post to further distribute your content.

WordPress Widgets

The following social plugins are available as WordPress widgets:

  • Activity Feed: Shows readers their friends’ activity on the site, such as likes and comments.
  • Recommendations: Gives readers personalized suggestions for pages on your site they might like, as well as a Recommendations Bar option to give users the option to add content to their Timeline as they read.
  • Customizable Like, Subscribe and Send buttons.
  • Comments Box: Makes it easy for people to comment on your site and post back to Facebook, and includes moderation tools. The plugin also features automatic SEO support for Facebook Comments, so search engines can index them to improve your site’s visibility.

TechCrunch, Buzz Media and The Next Web are already using the plugin to connect with their audiences while providing users with more engaging and personalized experiences. The plugin is available for all sites on WordPress.com VIP as well.

WordPress powers 16.6 percent of the web, from The New York Times to People Magazine, and attracts more than 600 million unique visitors each month. We hope the plugin makes it possible for WordPress content to be shared even more widely among people.

Learn more or download the plugin now.

Posted in Uncategorized | Leave a comment

Query or show a specific post in wordpress

If you are looking for php code or a plugin for your WordPress that takes a post ID and returns the database record for that post then read on. This is very helpful when you want to show a specific post on your homepage or other pages to get more attention. It allows you to design your homepage or a page with the post(s) that you want to be shown on the page rather than the 10 recent posts that the WordPress automatically chooses for you.

PHP Code Example to Query a WordPress Post

Example 1

The following code will Query the post with post id 26 and Show the title and the content.

<?php
$post_id = 26;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo $title;
echo $queried_post->post_content;
?>

Example 2

The following style could be more useful as it lets the user customise the font easily.

<?php
$post_id = 26;
$queried_post = get_post($post_id);
?>
<h2><?php echo $queried_post->post_title; ?></h2>
<?php echo $queried_post->post_content; ?>

Example 3

Using an Array… The following code will query every post number in ‘thePostIdArray’ and show the title of those posts.

<?php $thePostIdArray = array("28","74", "82", "92"); ?>
<?php $limit = 4 ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); $counter++; ?>
<?php if ( $counter < $limit + 1 ): ?>
<div id="post-<?php the_ID(); ?>">
<?php $post_id = $thePostIdArray[$counter-1]; ?>
<?php $queried_post = get_post($post_id); ?>
<h2><?php echo $queried_post->post_title; ?></h2>
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>

How to Display the Post Content Like WordPress

When you retrieve the post content from the database you get the unfiltered content. If you want to achieve the same output like WordPress does in its’ posts or pages then you need to apply filter to the content. You can use the following code:

<?php
$post_id = 26;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo $content;
?>

For a range of all the returned fields that you can use, check the WordPress site here.

Query X Number of Recent Posts

You can use the “wp_get_recent_posts” function to retrieve X number of recent posts and then display them however you want to. Here is an example:

<?php
//Query 5 recent published post in descending order
$args = array( 'numberposts' => '5', 'order' => 'DESC','post_status' => 'publish' );
$recent_posts = wp_get_recent_posts( $args );
//Now lets do something with these posts
foreach( $recent_posts as $recent )
{
    echo 'Post ID: '.$recent["ID"];
    echo 'Post URL: '.get_permalink($recent["ID"]);
    echo 'Post Title: '.$recent["post_title"];
    //Do whatever else you please with this WordPress post
}
?>

Using a Plugin to List all Posts Alphabetically

You can also use the WP Alphabetic Listing WordPress plugin to list all your posts.

Posted in Uncategorized | Leave a comment

Post on your WordPress blog using PHP

Here is the function. This code is not made for being used within WordPress, so don’t paste it on your functions.php file (or any other).

Please note that you must activate the XMLRPC posting option in your WordPress blog. If this option isn’t activated, the code will not be able to insert anything into your blog database. Another thing, make sure the XMLRPC functions are activated on your php.ini file.

function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$category,$keywords='',$encoding='UTF-8') {
    $title = htmlentities($title,ENT_NOQUOTES,$encoding);
    $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);

    $content = array(
        'title'=>$title,
        'description'=>$body,
        'mt_allow_comments'=>0,  // 1 to allow comments
        'mt_allow_pings'=>0,  // 1 to allow trackbacks
        'post_type'=>'post',
        'mt_keywords'=>$keywords,
        'categories'=>array($category)
    );
    $params = array(0,$username,$password,$content,true);
    $request = xmlrpc_encode_request('metaWeblog.newPost',$params);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_URL, $rpcurl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    $results = curl_exec($ch);
    curl_close($ch);
    return $results;
?>
Posted in Uncategorized | Leave a comment

WordPress $post Object Quick Reference

How to use the $post object

The values in the chart below can be accessed for a given post within the loop using the following syntax:

1
$post->$key;

…where key is the property you want to access below. For example, you’ll notice at the top of this post is a post summary within a formatted div element. The summary is just a formatted version of the post excerpt, but if there’s no post excerpt I don’t want that div element showing up empty, so in that case, I hide it using the following code:

1
2
3
4
5
6
7
8
<?php
if($post->post_excerpt != '') :
    echo '<div id="summary">';
    echo '<strong>Summary:</strong><br />';
    the_excerpt();
    echo '</div>';
endif;
?>

$post Object properties

Property Sample Value Notes
post_author 1 Post author’s user number
post_date 2008-03-15 19:22:29
post_date_gmt 2008-03-16 02:22:29 GMT = Greenwich Mean Time
post_content Actual post content, including markup
post_title Post title
post_category 0 Number representing post category ID#
post_excerpt Plain text without markup
post_status publish, pending, draft, private, inherit Current status of the post
comment_status open Possible values: open / closed
ping_status open open / closed
post_password Will be empty if no password
post_name statistics Same as post slug
to_ping http://www.1to-ping.com, http://www.2to-ping.com, http://www.3to-ping.com List of urls to ping when post is published (for unpublished posts)
pinged http://www.pinged1.com, http://www.pinged2.com, http://www.pinged3.com List of urls that have been pinged (for published posts)
post_modified 2008-07-01 19:41:28 Date the post was last modified
post_modified_gmt 2008-07-02 02:41:28 GMT date post was last modified
post_content_filtered Exists to store a cached version of post content (most likely with all the the_content filters already applied). If you’ve got a plugin that runs a very resource heavy filter on content, you might consider caching the results with post_content_filtered, and calling that from the front end instead.
post_parent ID# of this post’s parent. In the case of attachments, will be the post it’s attached to. Defaults to 0 if no parent.
guid http://www.blogurl/postslug Global Unique Identifier. The “real” URL to the post, not the permalink version. For pages, this is the actual URL. In the case of files (attachments), this holds the URL to the file.
menu_order 0
1
2
etc…
Holds values for display order of pages. Only works with pages, not posts.
post_type page
post
attachment
revision
Self-explanatory for pages and posts. Any files uploaded are attachments and post revisions saved as revision
post_mime_type text/html
image/png
image/jpg
Only used for files (attachments). Contains the MIME type of the uploaded file.
comment_count 4 Number of comments, pings, and trackbacks combined

Thanks to everyone who commented on this post to help fill in some of the missing values!

Posted in Uncategorized | Leave a comment

Function Reference/get post

Description

Takes a post ID and returns the database record for that post. You can specify, by means of the $output parameter, how you would like the results returned.

Usage

<?php get_post$id$output$filter ); ?> 

Parameters

$id
(integer or object) (optional) The ID of the post you’d like to fetch, or an object that specifies the post. By default the current post is fetched.

Default: null
$output
(string) (optional) How you’d like the result.

  • OBJECT – (default) returns a WP_Post object
  • ARRAY_A – Returns an associative array of field names to values
  • ARRAY_N – returns a numeric array of field values
Default: OBJECT
$filter
(string) (optional) Filter the post.

  • raw – (default)
Default: raw

Example

To get the title for a post with ID 7:

<?php
$post_7 
get_post(7);
$title $post_7->post_title;
?> 

Alternatively, specify the $output parameter:

<?php
$post_7 
get_post(7ARRAY_A);
$title $post_7['post_title'];
?> 

Return

Returns a WP_Post object, or null on failure.

The fields returned are:

ID 
(integer) The post ID
post_author 
(integer) The post author’s ID
post_date 
(string) The datetime of the post (YYYY-MM-DD HH:MM:SS)
post_date_gmt 
(string) The GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
post_content 
(string) The post’s contents
post_title 
(string) The post’s title
post_category 
(integer) The post category’s ID. Note that this will always be 0 (zero) from wordpress 2.1 onwards. To determine a post’s category or categories, use get_the_category().
post_excerpt 
(string) The post excerpt
post_status 
(string) The post status (publish|pending|draft|private|static|object|attachment|inherit|future|trash)
comment_status 
(string) The comment status (open|closed|registered_only)
ping_status 
(string) The pingback/trackback status (open|closed)
post_password 
(string) The post password
post_name 
(string) The post’s URL slug
to_ping 
(string) URLs to be pinged
pinged 
(string) URLs already pinged
post_modified 
(string) The last modified datetime of the post (YYYY-MM-DD HH:MM:SS)
post_modified_gmt 
(string) The last modified GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
post_content_filtered 
(string)
post_parent 
(integer) The parent post’s ID (for attachments, etc)
guid 
(string) A link to the post. Note: One cannot rely upon the GUID to be the permalink (as it was previous to version 2.5), Nor can you expect it to be a valid link to the post. It’s merely a unique identifier, which so happens to be a link to the post at present.
menu_order 
(integer)
post_type 
(string) (post|page|attachment)
post_mime_type 
(string) Mime Type (for attachments, etc)
comment_count 
(integer) Number of comments

Notes

Before version 3.5, the first parameter $post was required to be a variable. For example, get_post(7) would cause a fatal error.

Source File

get_post() is located in wp-includes/post.php and wp-includes/class-wp-atom-server.php.

Posted in Uncategorized | Leave a comment

The State of SEO and My Public Niche Site Project

Podcast 16: The State of SEO and My Public Niche Site ProjectA new podcast is here!

I felt like it was time that I sat behind the microphone and shared a few of my thoughts on the current state of SEO and my public niche site project.  In fact, as I look back at when I published my last podcast, its been over 4 months!  What I think you will find here are some motivational words to help you see how I view the world of Search Engine Optimization and more.

In addition, I cover a few topics in regards to my niche site project that I haven’t mentioned previously on my blog yet.  So, its definitely worth a listen.  Here’s is some of the information I cover in the podcast:

The State of SEO

Overall, I believe that the state of SEO is very good.  Meaning, I believe that now is just as good a time as any to build and rank niche websites in Google.

I share a couple of pieces of evidence to support this claim.  First, I think I’ve done a decent job showing that its very possible to build and rank a niche website with my survival knife site for my niche site project.  This is proof that you can type into Google and see for yourself, so you don’t really have to take my word for it.

However, I often find myself looking to other companies when I want some extra motivation.  One such company that I check in on from time to time is Demand Media, Inc.  The company is publicly traded on the NYSE under the ticker symbol DMD.

If you are not familiar with Demand Media, they own the websites: eHow.com, LiveStrong.com, Cracked.com, and many others.  I often look to this company for inspiration because they are employing the exact same business strategy that I am for my business!  Yes, they own much larger websites and implement this strategy on a much larger scale, but at its core, the strategy is really the same.

Demand Media does lots of market and keyword research, and once they find a low competition keyword based on their own formula, they hire freelance writers to create an article on the topic.  Then the article gets posted on ehow.com where it gets free traffic from Google and makes money from Google Adsense or other contextual ads.

Sound familiar?

This is essentially what I do with my niche websites.

So, I get my inspiration when I look at their financials and see growth.  Below is a copy of their quarterly income statement:

demandmediaincome

You will see that they are clearly growing.  They had a net loss for the quarter ending Mar. 30th, 2012, but have since seen increasing net incomes for the next 3 quarters.  This is encouraging, because the 2011 and 2012 were shaky years for SEO with the Panda and Penguin Google updates.

So, clearly Demand Media has found a way to continue to grow after these updates.

And so have I.

My Public Niche Site Project

Despite some setbacks in 2011 and 2012 with all the Google changes (and my Google Adsense account mishap…and by the way I still have my new Adsense account open and all is well); I am seeing some real success in 2013.  In fact the last few sites that I’ve built have all reached page one of Google.

So, what does this mean?  To me it means that I’ve learned and improved my processes.  What I was doing in 2011 and even early 2012 does not work anymore.  This is exactly what Demand Media has done as well…we’ve shifted our tactics slightly.

If you are just starting out in the niche website business, I actually think you are lucky!  You can start doing things the right way and hopefully never experience some of the big penalties that have happened over the past couple of years.

On the podcast, I shared some of the traffic and earning numbers for the site.  The past few days I’ve been getting 500 unique visitors per day to my survival knife site!  This is huge.  Now obviously some of that is from my blog readers here, but how much is tough to quantify.

However, I AM selling lots of survival knifes, and I don’t think that’s coming from you :) .  As of yesterday, I’ve made about $120 in Amazon Associates revenue for the month of April.  I hope to hit at least $250 for this month, and then $500 for the month of May.

googleanalyticsapril15

Click to Enlarge

In order to increase the amount I’m making on the site I have 3 plans.  Rank higher.  Add more content.  Add an email list.

In fact, just yesterday I added an email opt-in form to the site to start collecting email addresses.  I currently have 4 emails that will go out in an auto-responder series that essentially drive people to different pages of my website.  So, once people are on my email list, I can drive them to individual knife reviews or my knife chart to get more clicks, and hopefully purchases.

However, I am also on the lookout for good survival related affiliate products.  I’m sure there are some good survival or emergency preparedness ebooks, but I haven’t found the right one yet.  Once I do, I will be able to add this to my email marketing plan to further monetize my site.

Here’s what my email opt-in form looks like (just a template provided by Aweber):

emailoptinform

In addition, I plan on adding a Twitter page to gain some more followers.  Thanks to a strategy that I was recently reminded of by Cliff Ravenscraft of PodcastAnswerMan.com, I should be able to gain a decent following without too much work. Cliff discussed this strategy at the Social Media Marketing World conference which I attended last week in San Diego, CA.

In a nutshell, I am going to use Tweet Adder to automatically follow people on Twitter that are interested in the survival niche.  Tweet Adder is a tool that I have used in the past, and to be honest, works pretty well.  When you follow people, many of those people will follow you back.  So, if you follow enough people, you can build up a decent following.

This is how I gained an initial following on my Twitter page for NichePursuits.com, I used Tweet Adder.

I have nothing to lose by doing this with my survival knife site since I have NO Twitter following right now.  I’ll provide updates on this once I get started.

Your Thoughts

Overall, the state of SEO is very good.  I’m doing well with my niche websites, and other companies including Demand Media are achieving record profits.

I’ve shared what’s working for my niche site and what my plans are for the future.  The podcast below has even a few more details that I couldn’t cover in the text here.

I would love to hear any comments or questions that you have below!

You can listen to the podcast on iTunes right here.

Click Play to Listen to the Podcast!

Podcast: Play in new window | Download

Posted in Uncategorized | Leave a comment

38 Free WordPress Themes for Niche Websites

 

 

38 Free WordPress Themes for Niche WebsitesWhat’s the best WordPress Theme to use for niche Adsense sites?  Is there one theme that should be used all the time?  Or should a new theme be used for each site? These are some of the questions that you should consider when building sites.  If you are only building one or two larger sites, then this is really not an issue.  You just find a great looking theme for your site and go for it!

However, if you are going to be building dozens of small niche sites, in my opinion you will want to use different looking themes for nearly all your sites.  The reason?  Manual reviews.  If for any reason Google decides to manually review your sites, you don’t want to get caught with having every single one of your sites looking exactly the same.  If nothing looks unique or original on your sites, then this will raise a big red flag to a manual reviewer.  Of course, we never know exactly what the Google algorithm or manual reviewers are going to do when they visit our sites, so I believe its best to keep each site looking as unique as possible.

I personally started out building lots of small niche sites about 2 years ago (I built several other larger sites before that were complete flops).  When I was building those sites, I used the exact same theme on all of them.  All of my sites looked exactly the same with the same theme, same ad layouts, colors, and everything.  Since that time, I’m pretty sure these sites were manually reviewed (can you ever know for sure?), penalized, and I had other tough learning experiences.  I went on from those experiences to build more unique sites and produced better content, and as a result my Google Adsense earnings have surpassed what they were before these “tough” experiences.

So, I have some background when I state that you want to try to make each site as unique as possible.  Yes, its a little more work, but I believe its worth it.  Now when I build my sites, I do my best to use a different theme on each site.  I certainly have some repeats of themes that I really like; however, I do my best to switch it up.  Here are a list of both free and paid themes that I have used in the past for my niche websites.

38 Free Themes for Niche Websites

1. Bluesense – This and Prosense are the 2 themes that I used on all of my sites initially.  Bluesense produces the best Click Through Rate I have ever seen.  However, lots of these sites got penalized.  I don’t think it was Bluesense per se that caused it, but the fact that I used the same theme (could have been any theme?) on all my sites. I don’t use these themes on new sites now.

2. Prosense Grey – Another free theme by DoshDosh, like Bluesense.  (Please note that DoshDosh.com no longer appears to be a working site [which is really sad because it was an excellent blog] so these themes will not be up to date).

3. Green Park 2 by Cordobo.com

4. DarkZen by DailyBlogTips

5. iFeature theme

6. iStudio theme

7. Platform theme

8. zBench theme

9. EvoLve Theme

10. Arjuna X theme

11. Light and Modern Theme

12. zeeDisplay Theme by ThemeZee.com

13. Baza Noclegowa Theme

14. Light Clean Blue Theme

15. Minimal Georgia Theme

16. Mflat theme

17. Magazine Basic Theme

18 – 30. Fthemes.com – I have probably used over a dozen free themes from this site.  The only downside is they require links in the footer to their sites, the theme will be disabled if you mess with the links.  Or you can pay $19 to buy the theme without the links.

31. Application Theme

32. Jenny Theme by SpeckyGeek.com

33. iBlog Theme

34. Whitehouse Theme

35. Intrepidity Theme

36. Magnolia Theme

37. SilverRay by BlogPerfume.com

38. Original Premium News by WooThemes

Premium Themes (Not free)

39. Arthemia by Color Labs

40. Polished theme by Elegant Themes

41. Coldstone theme by Elegant Themes

42. ThemeForest.com – I have purchased a few premium themes from Theme Forest (including the one for the NichePursuits blog!); so there are lots of good options here for those sites you want a real eye catching design for.

Posted in Uncategorized | Leave a comment