Advertisement
cyberdev

Untitled

Aug 16th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. function bimber_custom_render_entry_flags( $args = array() ) {
  2. $args = wp_parse_args( $args, array(
  3. 'show_collections' => true,
  4. ) );
  5.  
  6. $flags = array();
  7.  
  8. if ( $args['show_collections'] ) {
  9. if ( bimber_has_trending_collection() && bimber_is_post_trending() ) {
  10. $flags['trending'] = array(
  11. 'label' => __( 'Trending', 'bimber' ),
  12. 'url' => bimber_get_trending_page_url()
  13. );
  14. }
  15.  
  16. if ( bimber_has_hot_collection() && bimber_is_post_hot() ) {
  17. $flags['hot'] = array(
  18. 'label' => __( 'Hot', 'bimber' ),
  19. 'url' => bimber_get_hot_page_url()
  20. );
  21. }
  22.  
  23. if ( bimber_has_popular_collection() && bimber_is_post_popular() ) {
  24. $flags['popular'] = array(
  25. 'label' => __( 'Popular', 'bimber' ),
  26. 'url' => bimber_get_popular_page_url()
  27. );
  28. }
  29. }
  30.  
  31.  
  32. $flags = apply_filters( 'bimber_get_entry_flags', $flags );
  33.  
  34. $show_reactions = bimber_can_use_plugin( 'whats-your-reaction/whats-your-reaction.php' ) && apply_filters( 'bimber_show_entry_reactions', true );
  35.  
  36. $wyr_terms = array();
  37.  
  38. if ( $show_reactions ) {
  39. $wyr_terms = wyr_get_post_reactions();
  40. }
  41. ?>
  42. <?php if ( count( $flags ) || count( $wyr_terms ) ) : ?>
  43. <div class="entry-flags">
  44. <p class="bimber-custom-top-flags">
  45. <?php foreach ( $flags as $flag_id => $flag_args ) : ?>
  46. <a class="entry-flag entry-flag-<?php echo sanitize_html_class( $flag_id ); ?>" href="<?php echo esc_url( $flag_args['url'] ); ?>" title="<?php echo esc_attr( $flag_args['label'] ); ?>">
  47. <?php echo esc_html( $flag_args['label'] ); ?>
  48. </a>
  49. <?php endforeach; ?>
  50. </p>
  51. <p class="bimber-custom-reaction-flags">
  52. <?php if ( $show_reactions ) : ?>
  53. <?php foreach ( $wyr_terms as $wyr_term ) : ?>
  54. <a class="entry-flag entry-flag-reaction" href="<?php echo esc_url( get_term_link( $wyr_term ) ); ?>" title="<?php echo esc_attr( $wyr_term->name ); ?>">
  55. <?php wyr_render_reaction_icon( $wyr_term->term_id ); ?>
  56. </a>
  57. <?php endforeach; ?>
  58. <?php endif; ?>
  59. </p>
  60. </div>
  61. <?php endif;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement