Created
April 23, 2014 06:49
-
-
Save code-flow/11204937 to your computer and use it in GitHub Desktop.
Purple Heart to Pages as Shortcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Purple Heart to Pages as Shortcode | |
*/ | |
add_action( 'wp', 'add_phrating_to_pages', 10 ); | |
function add_phrating_to_pages() { | |
global $post, $wpb_purpleheart; | |
if ( ! is_a( $post, 'WP_Post' ) ) { | |
return; | |
} | |
if ( ! is_a( $wpb_purpleheart, 'WPB_Purple_Heart_Rating' ) ) { | |
return; | |
} | |
if ( get_post_type( $post ) == 'page' ) { | |
$wpb_purpleheart->_is_rating_active = true; | |
$wpb_purpleheart->_rating_in = 'shortcode'; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This little plugin adds the Purple Heart Rating on the "page" post type of WordPress by a shortcode. The shortcode then should be added using
<?php echo do_shortcode( '[purple_heart_rating]' ); ?>
in one of your themes template files.