예제 #1
0
파일: cards.php 프로젝트: Teplitsa/giger
/** Post card content **/
function tst_post_card($cpost, $tax = 'auctor')
{
    if (is_int($cpost)) {
        $cpost = get_post($cpost);
    }
    $pl = get_permalink($cpost);
    $e = tst_get_post_excerpt($cpost, 30, true);
    $date = "<time>" . get_the_date('d.m.Y.', $cpost->ID) . "</time> - ";
    $css = 'mdl-cell--4-col';
    if (isset($cpost->grid_css)) {
        $css = $cpost->grid_css;
    }
    ?>
<article <?php 
    post_class('mdl-cell masonry-item ' . $css);
    ?>
>
<div class="tpl-card-blank mdl-card mdl-shadow--2dp">
	
	<?php 
    if (has_post_thumbnail($cpost->ID)) {
        ?>
		<div class="mdl-card__media"><a href="<?php 
        echo $pl;
        ?>
">
			<?php 
        echo get_the_post_thumbnail($cpost->ID, 'post-thumbnail', array('alt' => __('Thumbnail', 'tst')));
        ?>
		</a></div>			
	<?php 
    }
    ?>
	
	<?php 
    if ($tax == 'auctor' && tst_has_authors()) {
        $author = tst_get_post_author($cpost);
        $name = $author ? $author->name : '';
        $desc = $author ? wp_trim_words($author->description, 20) : '';
        $avatar = $author ? tst_get_author_avatar($author->term_id) : '';
        ?>
		<div class="entry-author mdl-card__supporting-text">		
			<div class="pictured-card-item">
				<div class="author-avatar round-image pci-img"><?php 
        echo $avatar;
        ?>
</div>
					
				<div class="author-content card-footer-content pci-content">
					<h5 class="author-name mdl-typography--body-1"><?php 
        echo apply_filters('tst_the_title', $name);
        ?>
</h5>
					<?php 
        if (!empty($desc)) {
            ?>
						<p class="author-role mdl-typography--caption"><?php 
            echo apply_filters('tst_the_title', $desc);
            ?>
</p>
					<?php 
        }
        ?>
				</div>
			</div>
		</div>
	<?php 
    } elseif ($tax != 'auctor') {
        echo get_the_term_list($cpost->ID, $tax, '<div class="entry-tax mdl-card__supporting-text">', ', ', '</div>');
    }
    ?>
	<div class="mdl-card__title">
		<h4 class="mdl-card__title-text"><a href="<?php 
    echo $pl;
    ?>
"><?php 
    echo get_the_title($cpost->ID);
    ?>
</a></h4>
	</div>
	
	<?php 
    echo tst_card_summary($date . $e);
    ?>
	<div class="mdl-card--expand"></div>
	<div class="mdl-card__actions mdl-card--border">
		<a href="<?php 
    echo $pl;
    ?>
" class="mdl-button mdl-js-button"><?php 
    _e('Details', 'tst');
    ?>
</a>
	</div>
</div>
</article>
<?php 
}
예제 #2
0
    if (is_home()) {
        $p = get_post(get_option('page_for_posts'));
        if ($p) {
            echo get_the_title($p);
        }
    } elseif (is_category() || is_tax()) {
        single_cat_title();
    } elseif (is_post_type_archive('org')) {
        echo tst_get_post_type_archive_title('org');
    } elseif (is_post_type_archive('project')) {
        echo tst_get_post_type_archive_title('project');
    }
    ?>
	</h1>
	<?php 
    if (tst_has_authors() && is_tax('auctor') || is_category() || is_tax('org_cat') || is_tax('person_cat')) {
        $qo = get_queried_object();
        echo "<div class='author-description'>";
        //print event empty - we need it for layout
        if (isset($qo->description)) {
            echo apply_filters('tst_the_title', $qo->description);
        }
        echo "</div>";
    }
    ?>
	</div>
</div>
<?php 
}
//singular
?>
예제 #3
0
/** Author **/
function tst_get_post_author($cpost)
{
    if (!tst_has_authors()) {
        return false;
    }
    $author = get_the_terms($cpost->ID, 'auctor');
    if (!empty($author) && !is_wp_error($author)) {
        $author = $author[0];
    }
    return $author;
}