Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bimber_custom_render_entry_flags( $args = array() ) {
- $args = wp_parse_args( $args, array(
- 'show_collections' => true,
- ) );
- $flags = array();
- if ( $args['show_collections'] ) {
- if ( bimber_has_trending_collection() && bimber_is_post_trending() ) {
- $flags['trending'] = array(
- 'label' => __( 'Trending', 'bimber' ),
- 'url' => bimber_get_trending_page_url()
- );
- }
- if ( bimber_has_hot_collection() && bimber_is_post_hot() ) {
- $flags['hot'] = array(
- 'label' => __( 'Hot', 'bimber' ),
- 'url' => bimber_get_hot_page_url()
- );
- }
- if ( bimber_has_popular_collection() && bimber_is_post_popular() ) {
- $flags['popular'] = array(
- 'label' => __( 'Popular', 'bimber' ),
- 'url' => bimber_get_popular_page_url()
- );
- }
- }
- $flags = apply_filters( 'bimber_get_entry_flags', $flags );
- $show_reactions = bimber_can_use_plugin( 'whats-your-reaction/whats-your-reaction.php' ) && apply_filters( 'bimber_show_entry_reactions', true );
- $wyr_terms = array();
- if ( $show_reactions ) {
- $wyr_terms = wyr_get_post_reactions();
- }
- ?>
- <?php if ( count( $flags ) || count( $wyr_terms ) ) : ?>
- <div class="entry-flags">
- <p class="bimber-custom-top-flags">
- <?php foreach ( $flags as $flag_id => $flag_args ) : ?>
- <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'] ); ?>">
- <?php echo esc_html( $flag_args['label'] ); ?>
- </a>
- <?php endforeach; ?>
- </p>
- <p class="bimber-custom-reaction-flags">
- <?php if ( $show_reactions ) : ?>
- <?php foreach ( $wyr_terms as $wyr_term ) : ?>
- <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 ); ?>">
- <?php wyr_render_reaction_icon( $wyr_term->term_id ); ?>
- </a>
- <?php endforeach; ?>
- <?php endif; ?>
- </p>
- </div>
- <?php endif;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement