Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'jnews_module_post_meta_1', 'feedzy_post_meta_1', 99, 3 );
- add_filter( 'jnews_module_post_meta_3', 'feedzy_post_meta_3', 99, 3 );
- function feedzy_post_meta_1( $output, $post, $instance ) {
- if ( ! empty( feedzy_get_author( $post ) ) ) {
- $feed = false;
- $avatar = false;
- $output = '';
- if ( get_theme_mod( 'jnews_show_block_meta', true ) ) {
- $comment = jnews_get_comments_number( $post->ID );
- $view_count = jnews_meta_views( $post->ID );
- // author detail
- $author = isset( $post->post_author ) ? $post->post_author : 'rss_post';
- $is_rss = jnews_get_rss_post_id( $author );
- $author_url = ! empty( feedzy_author_link( $post ) ) ? feedzy_author_link( $post ) : get_author_posts_url( $author );
- $author_name = ! empty( feedzy_get_author( $post ) ) ? feedzy_get_author( $post ) : get_the_author_meta( 'display_name', $author );
- $author_avatar = ( $is_rss ? false : $avatar ) ?
- '<div class="jeg_author_avatar">
- ' . get_avatar( get_the_author_meta( 'ID', $post->post_author ), 80, null, get_the_author_meta( 'display_name', $post->post_author ) ) . '
- </div>' : '';
- $trending = ( jnews_get_metabox_value( 'jnews_single_post.trending_post', null, $post->ID ) ) ? '<div class="jeg_meta_trending"><a href="' . get_the_permalink( $post ) . '" aria-label="' . esc_html__( 'View this Trending Post', 'jnews' ) . '"><i class="fa fa-bolt"></i></a></div>' : '';
- if ( jnews_is_review( $post->ID ) ) {
- $rating = jnews_generate_rating( $post->ID, 'jeg_landing_review' );
- $output .= '<div class="jeg_post_meta">';
- $output .= $trending;
- $output .= get_theme_mod( 'jnews_show_block_meta_rating', true ) ? $rating : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_author', true ) ? ( jnews_check_coauthor_plus() ? '<div class="jeg_meta_author coauthor">' . jnews_get_author_coauthor( $post->ID, false, 'by', 1 ) . '</div>' : '<div class="jeg_meta_author"><span class="by">' . jnews_return_translation( 'by', 'jnews', 'by' ) . "</span> <a href=\"{$author_url}\">{$author_name}</a></div>" ) : '';
- $output .= '</div>';
- } else {
- $output .= '<div class="jeg_post_meta">';
- $output .= $trending;
- $output .= get_theme_mod( 'jnews_show_block_meta_author', true ) ? ( jnews_check_coauthor_plus() ? '<div class="jeg_meta_author coauthor">' . jnews_get_author_coauthor( $post->ID, $avatar, 'by', 1 ) . '</div>' : '<div class="jeg_meta_author">' . $author_avatar . '<span class="by">' . jnews_return_translation( 'by', 'jnews', 'by' ) . "</span> <a href=\"{$author_url}\">{$author_name}</a></div>" ) : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_date', true ) ? '<div class="jeg_meta_date"><a href="' . get_the_permalink( $post ) . '"><i class="fa fa-clock-o"></i> ' . $instance->format_date( $post ) . '</a></div>' : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_comment', true ) && ! $feed ? '<div class="jeg_meta_comment"><a href="' . jnews_get_respond_link( $post->ID ) . "\" ><i class=\"fa fa-comment-o\"></i> {$comment} </a></div>" : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_views', false ) && ! $feed ? '<div class="jeg_meta_views"><a href="' . get_the_permalink( $post->ID ) . "\" ><i class=\"fa fa-eye\"></i> {$view_count} </a></div>" : '';
- $output .= '</div>';
- }
- }
- }
- return $output;
- }
- function feedzy_post_meta_3( $post ) {
- if ( ! empty( feedzy_get_author( $post ) ) ) {
- $output = '';
- if ( get_theme_mod( 'jnews_show_block_meta', true ) ) {
- $trending = ( jnews_get_metabox_value( 'jnews_single_post.trending_post', null, $post->ID ) ) ? '<div class="jeg_meta_trending"><a href="' . get_the_permalink( $post ) . '" aria-label="' . esc_html__( 'View this Trending Post', 'jnews' ) . '"><i class="fa fa-bolt"></i></a></div>' : '';
- $view_count = jnews_meta_views( $post->ID );
- if ( jnews_is_review( $post->ID ) ) {
- $rating = jnews_generate_rating( $post->ID, 'jeg_landing_review' );
- $output .= '<div class="jeg_post_meta">';
- $output .= $trending;
- $output .= get_theme_mod( 'jnews_show_block_meta_rating', true ) ? $rating : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_date', true ) ? '<div class="jeg_meta_date"><a href="' . get_the_permalink( $post ) . '"><i class="fa fa-clock-o"></i> ' . $this->format_date( $post ) . '</a></div>' : '';
- $output .= '</div>';
- } else {
- // author detail
- $author = $post->post_author;
- $author_url = ! empty( feedzy_author_link( $post ) ) ? feedzy_author_link( $post ) : get_author_posts_url( $author );
- $author_name = ! empty( feedzy_get_author( $post ) ) ? feedzy_get_author( $post ) : get_the_author_meta( 'display_name', $author );
- $output .= '<div class="jeg_post_meta">';
- $output .= $trending;
- $output .= get_theme_mod( 'jnews_show_block_meta_author', true ) ? ( jnews_check_coauthor_plus() ? '<div class="jeg_meta_author coauthor">' . jnews_get_author_coauthor( $post->ID, false, 'by', 1 ) . '</div>' : '<div class="jeg_meta_author"><span class="by">' . jnews_return_translation( 'by', 'jnews', 'by' ) . "</span> <a href=\"{$author_url}\">{$author_name}</a></div>" ) : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_date', true ) ? '<div class="jeg_meta_date"><a href="' . get_the_permalink( $post ) . '"><i class="fa fa-clock-o"></i> ' . $this->format_date( $post ) . '</a></div>' : '';
- $output .= get_theme_mod( 'jnews_show_block_meta_views', false ) ? '<div class="jeg_meta_views"><a href="' . get_the_permalink( $post->ID ) . "\" ><i class=\"fa fa-eye\"></i> {$view_count} </a></div>" : '';
- $output .= '</div>';
- }
- }
- }
- return $output;
- }
- function feedzy_get_author( $post ) {
- $author = '';
- $feedzy = get_post_meta( $post->ID, 'feedzy', true );
- $job_id = get_post_meta( $post->ID, 'feedzy_job', true );
- $item_author = get_post_meta( $post->ID, 'feedzy_item_author', true );
- if ( intval( $feedzy ) !== 1 || empty( $job_id ) || empty( $item_author ) ) {
- return $author;
- }
- $link_author_admin = get_post_meta( $job_id, 'import_link_author_admin', true );
- $link_author_public = get_post_meta( $job_id, 'import_link_author_public', true );
- if ( $link_author_admin === 'yes' && is_admin() ) {
- $author = $item_author;
- } elseif ( $link_author_public === 'yes' && ! is_admin() ) {
- $author = $item_author;
- }
- return $author;
- }
- function feedzy_author_link( $post ) {
- $link = '';
- if ( ! $post ) {
- return $link;
- }
- $feedzy = get_post_meta( $post->ID, 'feedzy', true );
- $job_id = get_post_meta( $post->ID, 'feedzy_job', true );
- $item_url = get_post_meta( $post->ID, 'feedzy_item_url', true );
- if ( intval( $feedzy ) !== 1 || empty( $job_id ) || empty( $item_url ) ) {
- return $link;
- }
- $link_author_public = get_post_meta( $job_id, 'import_link_author_public', true );
- if ( $link_author_public === 'yes' ) {
- $link = $item_url;
- }
- return $link;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement