Thursday, November 28, 2013

Add Author Profile Fields

If you want to create a more versatile author page, then you would need to add additional fields to the author profile. The code below will show you how to add additional twitter and facebook fields, but you can use it to add any other field that you like.


function my_new_contactmethods( $contactmethods )

// Add Twitter

$contactmethods['twitter'] = ‘Twitter’;

//add Facebook

$contactmethods['facebook'] = ‘Facebook’;


return $contactmethods;


add_filter(‘user_contactmethods’,'my_new_contactmethods’,10,1);


You can then call the fields in your author.php template by adding the following code:


<?php echo $curauth->twitter; ?>



Add Author Profile Fields

Disable Search in WordPress

When using WordPress as a CMS, sometimes the search feature becomes unnecessary. You can remove the search bar from the design, but the functionality still remains. You can add the following function and disable the search function:


function fb_filter_query( $query, $error = true )


if ( is_search() )

$query->is_search = false;

$query->query_vars[s] = false;

$query->query[s] = false;


// to error

if ( $error == true )

$query->is_404 = true;


add_action( ‘parse_query’, ‘fb_filter_query’ );

add_filter( ‘get_search_form’, create_function( ‘$a’, “return null;” ) );



Disable Search in WordPress

Enable Adsense Shortcode

Adsense is one of the most popular ad elements used by bloggers. Theme designers can place the adsense box in one spot which limits the users. If you want to give your client the ability to add the adsense anywhere, then you can create a shortcode for the adsense using this function:


function showads()

return ‘<div id=”adsense”><script type=”text/javascript”><!–

google_ad_client = “pub-XXXXXXXXXXXXXX”;

google_ad_slot = “4668915978″;

google_ad_width = 468;

google_ad_height = 60;

//–>

</script>


<script type=”text/javascript”

src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>

</script></div>’;


add_shortcode(‘adsense’, ‘showads’);



Enable Adsense Shortcode

Custom Excerpt Length

By default the excerpt length is capped at 55 words. Many theme designers like to have the flexibility that is why WordPress lets you customize the excerpt length with this function:


function new_excerpt_length($length)

return 100;


add_filter(‘excerpt_length’, ‘new_excerpt_length’);



Custom Excerpt Length

Customize Excerpt More [...]

// custom excerpt ellipses for 2.9

function custom_excerpt_more($more)

return ‘…’;


add_filter(‘excerpt_more’, ‘custom_excerpt_more’);


/* custom excerpt ellipses for 2.8-

function custom_excerpt_more($excerpt)

return str_replace(‘[...]‘, ‘…’, $excerpt);


add_filter(‘wp_trim_excerpt’, ‘custom_excerpt_more’);

*/



Customize Excerpt More [...]

Display Twitter Followers Count and More

There are widgets that display Twitter followers count, but those are limited and ugly. You can use this function to customize the way your twitter followers count look on your blog. Simply paste the code below:


function rarst_twitter_user( $username, $field, $display = false )

$interval = 3600;

$cache = get_option(‘rarst_twitter_user’);

$url = ‘http://api.twitter.com/1/users/show.json?screen_name=’.urlencode($username);


if ( false == $cache )

$cache = array();


// if first time request add placeholder and force update

if ( !isset( $cache[$username][$field] ) )

$cache[$username][$field] = NULL;

$cache[$username]['lastcheck'] = 0;


// if outdated

if( $cache[$username]['lastcheck'] < (time()-$interval) )


// holds decoded JSON data in memory

static $memorycache;


if ( isset($memorycache[$username]) )

$data = $memorycache[$username];


else

$result = wp_remote_retrieve_body(wp_remote_request($url));

$data = json_decode( $result );

if ( is_object($data) )

$memorycache[$username] = $data;


if ( is_object($data) )

// update all fields, known to be requested

foreach ($cache[$username] as $key => $value)

if( isset($data->$key) )

$cache[$username][$key] = $data->$key;


$cache[$username]['lastcheck'] = time();


else

$cache[$username]['lastcheck'] = time()+60;


update_option( ‘rarst_twitter_user’, $cache );


if ( false != $display )

echo $cache[$username][$field];

return $cache[$username][$field];


Then place the following code where you want to display the count in your theme file:


echo rarst_twitter_user(‘wpbeginner’, ‘name’).’ has ‘.

rarst_twitter_user(‘wpbeginner’, ‘followers_count’).’ followers after ‘.

rarst_twitter_user(‘wpbeginner’, ‘statuses_count’).’ updates.’;



Display Twitter Followers Count and More

Adding an Author Image and Bio Box in WordPress, and Linking to a Google+ Profile

Sorry, no attachments exist.

Adding an Author Image and Bio Box in WordPress, and Linking to a Google+ Profile



Adding an Author Image and Bio Box in WordPress, and Linking to a Google+ Profile

All In One WP Security & Firewall

Sorry, no attachments exist.


A comprehensive, user-friendly, all in one WordPress security and firewall plugin for your site.


A COMPREHENSIVE, EASY TO USE AND WELL SUPPORTED WORDPRESS SECURITY PLUGIN


WordPress itself is a very secure platform. However, it helps to add some extra security and firewall to your site by using a security plugin that enforces a lot of good security practices.



All In One WP Security & Firewall

Sunday, November 24, 2013

PHP Time ago like facebook function

<?php

function ago($timestamp)

$difference = time() – strtotime($timestamp);

$periods = array(‘second’, ‘minute’, ‘hour’, ‘day’, ‘week’, ‘month’, ‘years’, ‘decade’);

$lengths = array(’60′, ’60′, ’24′, ’7′, ’4.35′, ’12′, ’10′);

for($j = 0; $difference >= $lengths[$j]; $j++) $difference /= $lengths[$j];

$difference = round($difference);

if($difference != 1) $periods[$j] .= “s”;

return “$difference $periods[$j] ago”;

echo ago(’2013-11-28 09:50:28′);

?>


PHP Time ago like facebook function

NextScripts: Social Networks Auto-Poster

Sorry, no attachments exist.
This plugin automatically publishes posts from your blog to your Social Network accounts such as Facebook, Twitter, Google+(Google Plus), Blogger, Tumblr, …

Automatically re-publishes blogposts to Facebook, Twitter, Google+, Pinterest, LinkedIn, Blogger, Tumblr, Delicious, Plurk, etc profiles and/or pages


NextScripts: Social Networks Auto-Poster

Magento product review on sidebar extension

Sorry, no attachments exist.

Magento product review on sidebar extension


Magento product review on sidebar extension

Wordpress Extension Add Link to Facebook

Sorry, no attachments exist.

Wordpress Extension Add Link to Facebook


Wordpress Extension Add Link to Facebook

Thursday, November 21, 2013

Saturday, November 16, 2013

Wordpress Extension Admin Drop Down Menu

Sorry, no attachments exist.

All admin links available in a neat horizontal drop down menu. Saves lots of screen real estate!

Wordpress Extension Admin Drop Down Menu


Wordpress Extension Admin Drop Down Menu

Wednesday, November 6, 2013

Custom Social networking sharing link

https://www.linkedin.com/cws/share?url=SITE_URL
http://twitter.com/home?status=SITE_URL
https://plus.google.com/share?url=SITE_URL
http://www.facebook.com/share.php?u=SITE_URL

Thursday, October 10, 2013

HTML and Javascript to share page on social networing site

<a href="#" onclick="window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="icon">Google Icon</a>
            <a href="#" onclick="window.open('http://twitter.com/home?status='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="icon">Twitter Icon</a>
            <a href="#" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="icon">Facebook Icon</a>