예제 #1
0
function risd_coauthors_posts_links($writer_string, $image_folks_string)
{
    global $post;
    $num_authors = get_post_meta($post->ID, 'number_of_authors', true);
    $co_auth_obj = new CoAuthorsIterator();
    $num_contributors = $co_auth_obj->count();
    # Check that the number_of_authors custom field is valid
    # If not, make everybody a writer
    if (!is_numeric($num_authors) || $num_authors < 1 || $num_authors > $num_contributors) {
        $num_authors = $num_contributors;
    }
    echo $writer_string;
    $count = 0;
    while ($co_auth_obj->iterate()) {
        the_author_posts_link();
        $count++;
        # number of contributors we've displayed
        risd_add_delimiter($image_folks_string, $count, $num_authors, $num_contributors);
    }
}
function coauthors__echo($tag, $type = 'tag', $separators = array(), $tag_args = null, $echo = true)
{
    // Define the standard output separator. Constant support is for backwards compat.
    // @see https://github.com/danielbachhuber/Co-Authors-Plus/issues/12
    $default_before = defined('COAUTHORS_DEFAULT_BEFORE') ? COAUTHORS_DEFAULT_BEFORE : '';
    $default_between = defined('COAUTHORS_DEFAULT_BETWEEN') ? COAUTHORS_DEFAULT_BETWEEN : ', ';
    $default_between_last = defined('COAUTHORS_DEFAULT_BETWEEN_LAST') ? COAUTHORS_DEFAULT_BETWEEN_LAST : __(' and ', 'co-authors-plus');
    $default_after = defined('COAUTHORS_DEFAULT_AFTER') ? COAUTHORS_DEFAULT_AFTER : '';
    if (!isset($separators['before']) || null === $separators['before']) {
        $separators['before'] = apply_filters('coauthors_default_before', $default_before);
    }
    if (!isset($separators['between']) || null === $separators['between']) {
        $separators['between'] = apply_filters('coauthors_default_between', $default_between);
    }
    if (!isset($separators['betweenLast']) || null === $separators['betweenLast']) {
        $separators['betweenLast'] = apply_filters('coauthors_default_between_last', $default_between_last);
    }
    if (!isset($separators['after']) || null === $separators['after']) {
        $separators['after'] = apply_filters('coauthors_default_after', $default_after);
    }
    $output = '';
    $i = new CoAuthorsIterator();
    $output .= $separators['before'];
    $i->iterate();
    do {
        $author_text = '';
        if ('tag' === $type) {
            $author_text = $tag($tag_args);
        } elseif ('field' === $type && isset($i->current_author->{$tag})) {
            $author_text = $i->current_author->{$tag};
        } elseif ('callback' === $type && is_callable($tag)) {
            $author_text = call_user_func($tag, $i->current_author);
        }
        // Fallback to user_login if we get something empty
        if (empty($author_text)) {
            $author_text = $i->current_author->user_login;
        }
        // Append separators
        if ($i->count() - $i->position == 1) {
            // last author or only author
            $output .= $author_text;
        } elseif ($i->count() - $i->position == 2) {
            // second to last
            $output .= $author_text . $separators['betweenLast'];
        } else {
            $output .= $author_text . $separators['between'];
        }
    } while ($i->iterate());
    $output .= $separators['after'];
    if ($echo) {
        echo $output;
    }
    return $output;
}
예제 #3
0
파일: single.php 프로젝트: TVLuke/wordpress
 Themen</h2>
		<p class="smalltext"><?php 
            the_tags('', ' &middot; ', '');
            ?>
 </p>
	</div>
	<?php 
        }
        ?>
	<div class="sidebar-section">
		<h2 class="smalltitle">
			<?php 
        //Autor(en)
        echo '<img src="' . get_bloginfo('template_directory') . '/images/author16px.png" alt="autor"/> ';
        $authors = new CoAuthorsIterator();
        print $authors->count() == 1 ? 'Der Autor' : 'Die Autoren';
        ?>
		</h2>
		<ul class="smalltext authors">
			<?php 
        coauthors_posts_links('</li><li>', '</li><li>', '<li>', '</li>');
        ?>
		</ul>
	</div>
	<div class="sidebar-section">
		<h2 class="smalltitle"><?php 
        echo '<img src="' . get_bloginfo('template_directory') . '/images/calendar16px.png" alt="kalender"/> ';
        ?>
Datum</h2>
		<?php 
        //Datum