How to create custom social share buttons

How to create custom social share buttons

Facebook:

http://www.facebook.com/share.php?u=[URL]&title=[TITLE]

Twitter:

http://twitter.com/intent/tweet?status=[TITLE]+[URL]

Pinterest:

http://pinterest.com/pin/create/bookmarklet/?media=[MEDIA]&url=[URL]&is_video=false&description=[TITLE]

Google+:

https://plus.google.com/share?url=[URL]

Linkedin:

http://www.linkedin.com/shareArticle?mini=true&url=[URL]&title=[TITLE]&source=[SOURCE/DOMAIN]

After this I use a this html code:


<a class="share" href="some of upper code">your image</a>

And the javascript:


jQuery(document).ready(function ($) {

    $('a.share').click(function () {
        return !window.open(this.href, "pop", "width=600,height=600");
    });

});

I use this for project: beatsbydre

 

 

 

Get posts ids by post title

Get posts ids by post title

function get_posts_by_title($title, $post_type = 'post') {
   global $wpdb;
   $posts_ids = array();
   $posts = $wpdb->get_results($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type = '" . $post_type . "'", $title),     OBJECT);
   foreach ($posts as $post) {
       $posts_ids[] = $post->ID;
   }
   return $posts_ids;
}

Put this function in functions.php and can use in your code.

This function I use in project beatsbydre