Skip to content

Instantly share code, notes, and snippets.

View pudan-k's full-sized avatar

Pudan K pudan-k

View GitHub Profile
@JonMasterson
JonMasterson / alternate-function
Created November 5, 2013 17:40
Swap Font Awesome Icons based on the number of likes post receives. Can be used with my WordPress Like System.
<?php
/**
* Swap Function (5) with the following
* (5)(b) Front end button
*/
function getPostLikeLink( $post_id ) {
$theme_object = wp_get_theme();
$themename = esc_attr( $theme_object->Name ); // the theme name
$like_count = get_post_meta( $post_id, "_post_like_count", true ); // get post likes
if ( ( !$like_count ) || ( $like_count && $like_count == 0 ) ) { // no votes, set up empty variable