Exemple #1
0
/**
 * Load a Social Paper template part into a template.
 *
 * Essentially a duplicate of {@link get_template_part()} but supports
 * our custom template directory.
 *
 * @see get_template_part() for parameter documentation
 */
function cacsp_get_template_part($slug, $name = null)
{
    /** This action is documented in wp-includes/general-template.php */
    do_action("get_template_part_{$slug}", $slug, $name);
    $templates = array();
    $name = (string) $name;
    if ('' !== $name) {
        $templates[] = "{$slug}-{$name}.php";
    }
    $templates[] = "{$slug}.php";
    cacsp_locate_template($templates, true, false);
}
/**
 * Clears the buffer for content replacement on the Social Paper archive page.
 *
 * This is also where we call our custom directory template.
 *
 * @access private
 *
 * @param WP_Query $q
 */
function _cacsp_archive_ob_end($q)
{
    if (false === Social_Paper::$is_buffer) {
        return;
    }
    if (false === cacsp_is_archive()) {
        return;
    }
    ob_end_clean();
    remove_action('loop_end', '_cacsp_archive_ob_end', 999);
    // rewind posts if papers exist to display them in our template
    if (false === Social_Paper::$is_empty_archive) {
        $q->rewind_posts();
    }
    $templates = array();
    if (function_exists('buddypress')) {
        $templates[] = 'content-directory-social-paper-buddypress.php';
    }
    $templates[] = 'content-directory-social-paper.php';
    cacsp_locate_template($templates, true);
}
			<?php 
    /* translators: %s: Name of current post */
    the_content(sprintf(__('Continue reading %s', 'twentyfifteen'), the_title('<span class="screen-reader-text">', '</span>', false)));
    ?>

			<?php 
    wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'social-paper') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '<span class="screen-reader-text">' . __('Page', 'social-paper') . ' </span>%', 'separator' => '<span class="screen-reader-text">, </span>'));
    ?>
		</div><!-- .entry-content -->

		<?php 
    if (current_user_can('edit_post', get_queried_object()->ID)) {
        ?>
		<div class="entry-sidebar">
			<?php 
        cacsp_locate_template('sidebar-single-social-paper.php', true);
        ?>
		</div>
		<?php 
    }
    ?>

		<?php 
    if ('new' !== get_query_var('name') && 'auto-draft' !== get_queried_object()->post_status) {
        ?>
		<footer class="entry-footer">
			<div class="entry-author">
				<a href="<?php 
        the_author_meta('url');
        ?>
"><?php