Skip to content

Instantly share code, notes, and snippets.

@wpweb101
Created January 27, 2014 13:33
Show Gist options
  • Save wpweb101/8648623 to your computer and use it in GitHub Desktop.
Save wpweb101/8648623 to your computer and use it in GitHub Desktop.
Follow Autors listing
<?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['authors_follow_buttons']['follow'];
$followingtext = $wpw_fp_options['authors_follow_buttons']['following'];
$unfollowtext = $wpw_fp_options['authors_follow_buttons']['unfollow'];
?>
<style type="text/css">
.wpw-fp-follow-authors-wrap {
display: inline-block;
margin: auto auto 20px;
padding: 0 20px 0 0;
}
</style>
<h3><?php _e( 'Authors I Follow', 'wpwfp' ); ?></h3>
<?php
foreach ( $followauthors as $followauthor ) {
$authorid = isset( $followauthor['post_parent'] ) && !empty( $followauthor['post_parent'] ) ? $followauthor['post_parent'] : '';
if( !empty( $authorid ) ) { // Check post parent is not empty
$args = array(
'author_id' => $authorid,
'current_post_id' => $followauthor['ID'],
'follow_message' => '',
'follow_buttons' => array(
'follow' => trim( $followtext ),
'following' => trim( $followingtext ),
'unfollow' => trim( $unfollowtext ),
),
);
?>
<div class="wpw-fp-follow-authors-wrap">
<?php do_action( 'wpw_fp_follow_author', $args ); ?>
</div>
<?php
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment