/** * Add multi-author-mode to body class when Multi-Author Mode enabled */ function independent_publisher_multi_author_mode_body_class($classes) { if (independent_publisher_is_multi_author_mode()) { $classes[] = 'multi-author-mode'; } return $classes; }
/** * Outputs post author info for display on single posts * * @since Independent Publisher 1.0 */ function independent_publisher_posted_author_card() { /** * This function gets called outside the loop (in header.php), * so we need to figure out the post author ID and Nice Name manually. */ global $wp_query; $post_author_id = $wp_query->post->post_author; $show_avatars = get_option('show_avatars'); ?> <?php if ((!$show_avatars || $show_avatars === 0) && !independent_publisher_is_multi_author_mode() && get_header_image()) { ?> <a class="site-logo" href="<?php echo esc_url(home_url('/')); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home"> <img class="no-grav" src="<?php echo esc_url(get_header_image()); ?> " height="<?php echo absint(get_custom_header()->height); ?> " width="<?php echo absint(get_custom_header()->width); ?> " alt="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " /> </a> <?php } else { ?> <a class="site-logo" href="<?php echo get_author_posts_url(get_the_author_meta('ID', $post_author_id)); ?> "> <?php echo get_avatar(get_the_author_meta('ID', $post_author_id), 100); ?> </a> <?php } ?> <h1 class="site-title"><?php independent_publisher_posted_author(); ?> </h1> <h2 class="site-description"><?php the_author_meta('description', $post_author_id); ?> </h2> <?php get_template_part('menu', 'social'); ?> <div class="site-published-separator"></div> <h2 class="site-published"><?php _e('Published', 'independent-publisher'); ?> </h2> <h2 class="site-published-date"><?php independent_publisher_posted_on_date(); ?> </h2> <?php /* Show last updated date if the post was modified AND Show Updated Date on Single Posts option is enabled AND 'independent_publisher_hide_updated_date' Custom Field is not present on this post */ ?> <?php if (get_the_modified_date() !== get_the_date() && independent_publisher_show_updated_date_on_single() && !get_post_meta(get_the_ID(), 'independent_publisher_hide_updated_date', TRUE)) { ?> <h2 class="site-published"><?php _e('Updated', 'independent-publisher'); ?> </h2> <h2 class="site-published-date"><?php independent_publisher_post_updated_date(); ?> </h2> <?php } ?> <?php do_action('independent_publisher_after_post_published_date'); ?> <?php }
/** * Prints HTML with meta information for the current author and post categories. * * Only prints author name when Multi-Author Mode is enabled. * * @since Independent Publisher 1.0 */ function independent_publisher_posted_author_cats() { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list(__(', ', 'independent-publisher')); if (!post_password_required() && comments_open() && !independent_publisher_hide_comments() || !post_password_required() && independent_publisher_show_post_word_count() && !get_post_format() || independent_publisher_show_date_entry_meta()) { $separator = apply_filters('independent_publisher_entry_meta_separator', '|'); } else { $separator = ''; } if (independent_publisher_is_multi_author_mode()) { if ($categories_list && independent_publisher_categorized_blog()) { echo '<span class="cat-links">'; printf('<a href="%1$s" title="%2$s">%3$s</a> %4$s %5$s', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'independent-publisher'), get_the_author())), esc_html(get_the_author()), independent_publisher_entry_meta_category_prefix(), $categories_list); echo '</span> <span class="sep"> ' . $separator . '</span>'; } else { echo '<span class="cat-links">'; printf('%1$s <a href="%2$s" title="%3$s">%4$s</a>', independent_publisher_entry_meta_author_prefix(), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'independent-publisher'), get_the_author())), esc_html(get_the_author())); echo '</span>'; } // End if categories } else { // not Multi-Author Mode if ($categories_list && independent_publisher_categorized_blog()) { echo '<span class="cat-links">'; printf('%1$s %2$s', independent_publisher_entry_meta_category_prefix(), $categories_list); echo '</span> <span class="sep"> ' . $separator . '</span>'; } else { echo '<span class="cat-links">'; echo '</span>'; } // End if categories } // End if independent_publisher_is_multi_author_mode() }
?> </head> <body <?php body_class(); ?> itemscope="itemscope" itemtype="http://schema.org/WebPage"> <?php // Displays full-width featured image on Single Posts if applicable independent_publisher_full_width_featured_image(); ?> <?php // Makes the Header Image a small icon floating in the top left corner when Multi Author Mode is enabled if (independent_publisher_is_multi_author_mode() && is_single()) { ?> <div class="site-master-logo"> <?php if (get_header_image()) { ?> <a href="<?php echo esc_url(home_url('/')); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home"> <img class="no-grav" src="<?php echo esc_url(get_header_image()); ?>
} ?> </head> <body id="<?php echo $pageBodyID; ?> " <?php body_class($extraBodyClass); ?> itemscope="itemscope" itemtype="http://schema.org/WebPage"> <?php // Adding the logo/branding to single post pages. if (independent_publisher_is_multi_author_mode() && (is_single() || $pageBodyID == 'newsletter')) { ?> <div id="logoOnPostPages"> <?php independent_publisher_site_info(); ?> </div> <?php } ?> <?php // Displays full-width featured image on Single Posts if applicable if (is_single() || $pageBodyID == "newsletter") { independent_publisher_full_width_featured_image();