By the time you are through with this, you will be able to share Adsense revenue with your Guest Authors. This will surely attract more Authors to your Blog and consequently, your Blog traffic and popularity.
When I first saw this type of opening in one article by Google, I was so happy. I yelled deep inside me “Yes! This is what I’ve been looking for”. I was so wrong because that ended up not to be my solution but played a great part in finding a solution.
Google provides a mean by which you can share Google Adsense revenue with your website visitors or contributors, no matter the type of website you have Blog or Forum. With this Google Developer API, it is possible to do this but I was shocked when I saw that my Blog was not qualified. Why?
Here is Google’s original statement:
On September 13, 2007 Google changed its policy on who is be able to launch a live implementation of the AdSense Host API. To be eligible for the AdSense Host API a website must have user content pages that are receiving at least one hundred thousand (100,000) page views per day. All developers will need to fill out the Developer Information Form, even if you have already done so. Filling out this form will provide you with new credentials to use in the sandbox.
Where will I get this kind of traffic from. Am I Wikipedia. Later I discovered a way to do this without involving Google’s API. It’s a long tutorial so, I just summed it up. Just follow the few simple steps I will show you and you can start compensating your Blog Authors.
HERE IS HOW TO SET UP YOUR WORDPRESS BLOG TO START SHARING ADSENSE REVENUE WITH YOUR CONTRIBUTORS / AUTHORS:
If your aim is just to get on with adding this feature (Adsense sharing) to your blog and don’t care about knowing how the code works, here’s what you would do:
Open your functions.php file in the current theme you have activated.
Remember to back it up first. It’s always advisable to do that.
Are you through with that?
Now add this block of code to your functions.php just before the closing ?> tag:
// Create Custom Settings Menu
add_action('admin_menu', 'adshare_menu');
function adshare_menu() {
//Create Sub-Level Menu Page under Settings
add_submenu_page( 'options-general.php', 'Ad Share Settings', 'Ad Share', 'manage_options', 'adshare_settings_page', 'adshare_settings_page');
}
function adshare_settings_page() {
//must check that the user has the required capability
if (!current_user_can('manage_options'))
{
wp_die( __('You do not have sufficient permissions to access this page.') );
}
?>
<div>
<h2>Ad Share Settings</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>Adsense Publisher ID:</strong><br />
<input type="text" name="publisher-id" size="45" value="<?php echo get_option('publisher-id'); ?>" />
</p>
<p><input type="submit" name="Submit" value="Save" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="publisher-id" />
</form>
</div>
<?php
}
add_action( 'show_user_profile', 'adshare_profile_fields' );
add_action( 'edit_user_profile', 'adshare_profile_fields' );
function adshare_profile_fields( $user ) { ?>
<h3>Extra Field</h3>
<table>
<tr>
<th><label for="twitter">Adsense Publisher ID</label></th>
<td>
<input type="text" name="publisher-id" id="publisher-id" value="<?php echo esc_attr( get_the_author_meta( 'publisher-id', $user->ID ) ); ?>" /><br />
<span>Add your Publisher ID</span>
</td>
</tr>
</table>
<?php }
add_action( 'personal_options_update', 'adshare_save_profile_fields' );
add_action( 'edit_user_profile_update', 'adshare_save_profile_fields' );
function adshare_save_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) ){
return false;
}
update_usermeta( $user_id, 'publisher-id', $_POST['publisher-id'] ); //
}
function adsense_ad() {
if(get_the_author_meta( 'publisher-id' )){
$input = array(get_option('publisher-id'), get_the_author_meta( 'publisher-id' ));
}else{
$input = array(get_option('publisher-id'));
}
shuffle($input);
?>
<script type="text/javascript">
<!--
google_ad_client = "ca-<?php echo $input[0]; ?>";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<?php
}
Now add this little piece of code to your single.php file
<?php get_template_part( 'content', 'single' ); ?>
<?php adsense_ad(); ?> //Call Adsense Function
<?php comments_template( '', true ); ?>
WHAT THESE CODES WILL DO:
1. The first code will add an extra field which creates the option for users to save their own Publisher ID
2. The second code will make the ads of your Authors show on blog posts.
Your arts will be rotated with the ads of your authors. It changes whenever your pages are refreshed.
This way, you can compensate your Authors by sharing Adsense revenue with them and also get more Authors to post quality articles on your blog.
If you are looking for a detailed explanation of how the code works, you would have to wait till when I’m ready to post it.
I HOPE THIS HELPS!
If you don't want to miss anything on Cynamix please like us on Facebook and follow us on Twitter You can also subscribe to our updates by email or with your favourite browser. This way, you won't miss any updates from cynamix. If you subscribe by email, make sure to check your email to confirm your subscription.| Follow @cynamix |
Don't keep this to yourself, Share it with your friends with the Buttons below.



RECENT COMMENTS