Created
January 27, 2014 13:37
-
-
Save wpweb101/8648698 to your computer and use it in GitHub Desktop.
Follow Terms Listing
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 | |
global $wpw_fp_options; | |
$prefix = WPW_FP_META_PREFIX; | |
// get all custom post types | |
$post_types = get_post_types( array( 'public' => true ), 'objects' ); | |
$followtext = $wpw_fp_options['term_follow_buttons']['follow']; | |
$followingtext = $wpw_fp_options['term_follow_buttons']['following']; | |
$unfollowtext = $wpw_fp_options['term_follow_buttons']['unfollow']; | |
?> | |
<style type="text/css"> | |
.wpw-fp-follow-terms-wrap { | |
display: inline-block; | |
margin: auto auto 0; | |
padding: 0 20px 0 0; | |
} | |
</style> | |
<h3><?php _e( 'Terms I Follow', 'wpwfp' ); ?></h3> | |
<?php | |
foreach ( $followterms as $followterm ) { | |
$termid = isset( $followterm['post_parent'] ) && !empty( $followterm['post_parent'] ) ? $followterm['post_parent'] : ''; | |
if( !empty( $termid ) ) { // Check post parent is not empty | |
// Get Follow Post Type | |
$posttype = get_post_meta( $followterm['ID'], $prefix.'post_type', true ); | |
// Get Follow Taxonomy | |
$taxonomy = get_post_meta( $followterm['ID'], $prefix.'taxonomy_slug', true ); | |
$args = array( | |
'follow_posttype' => $posttype, | |
'follow_taxonomy' => $taxonomy, | |
'follow_term_id' => $termid, | |
'current_post_id' => $followterm['ID'], | |
'follow_message' => '', | |
'follow_buttons' => array( | |
'follow' => trim( $followtext ), | |
'following' => trim( $followingtext ), | |
'unfollow' => trim( $unfollowtext ), | |
), | |
); | |
?> | |
<div class="wpw-fp-follow-terms-wrap"> | |
<?php do_action( 'wpw_fp_follow_term', $args ); ?> | |
</div> | |
<?php | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment