コード例 #1
0
ファイル: template-tags.php プロジェクト: aptarmy/wp-toolbox
function get_related_posts()
{
    global $post;
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
        $tag_ids = array();
        foreach ($tags as $individual_tag) {
            $tag_ids[] = $individual_tag->term_id;
        }
        $related_posts_query = new WP_Query(array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => 4));
        while ($related_posts_query->have_posts()) {
            $related_posts_query->the_post();
            echo '<div class="col-sm-3 col-xs-6">';
            echo '<a href="' . get_permalink() . '"><div class="relatePost" style="background-image: url(' . get_featured_image_url() . ')" ><h4>' . get_the_title() . '</h4></div></a>';
            echo '</div>';
        }
    }
    wp_reset_query();
}
コード例 #2
0
function sc_person_picture_list($atts)
{
    $atts['type'] = $atts['type'] ? $atts['type'] : null;
    $row_size = $atts['row_size'] ? intval($atts['row_size']) : 5;
    $categories = $atts['categories'] ? $atts['categories'] : null;
    $org_groups = $atts['org_groups'] ? $atts['org_groups'] : null;
    $limit = $atts['limit'] ? intval($atts['limit']) : -1;
    $join = $atts['join'] ? $atts['join'] : 'or';
    $people = sc_object_list(array('type' => 'person', 'limit' => $limit, 'join' => $join, 'categories' => $categories, 'org_groups' => $org_groups), array('objects_only' => True));
    ob_start();
    ?>
<div class="person-picture-list"><?php 
    $count = 0;
    foreach ($people as $person) {
        $image_url = get_featured_image_url($person->ID);
        $link = $person->post_content != '' ? True : False;
        if ($count % $row_size == 0) {
            if ($count > 0) {
                ?>
</div><?php 
            }
            ?>
<div class="row"><?php 
        }
        ?>
		<div class="span2 person-picture-wrap">
			<?php 
        if ($link) {
            ?>
<a href="<?php 
            echo get_permalink($person->ID);
            ?>
"><?php 
        }
        ?>
				<img src="<?php 
        echo $image_url ? $image_url : get_bloginfo('stylesheet_directory') . '/static/img/no-photo.jpg';
        ?>
">
				<div class="name"><?php 
        echo Person::get_name($person);
        ?>
</div>
				<div class="title"><?php 
        echo get_post_meta($person->ID, 'person_jobtitle', True);
        ?>
</div>
				<?php 
        if ($link) {
            ?>
</a><?php 
        }
        ?>
		</div>
		<?php 
        $count++;
    }
    ?>
	</div>
	</div>
	<?php 
    return ob_get_clean();
}
コード例 #3
0
<?php

disallow_direct_load('single.php');
get_header();
the_post();
?>
	<div class="page-content person-profile">
		<div class="row">
			<div class="span2 details">
			<?php 
$title = get_post_meta($post->ID, 'person_jobtitle', True);
$image_url = get_featured_image_url($post->ID);
$email = get_post_meta($post->ID, 'person_email', True);
$phones = Person::get_phones($post);
?>
			<img src="<?php 
echo $image_url ? $image_url : get_bloginfo('stylesheet_directory') . '/static/img/no-photo.jpg';
?>
">
			<?php 
if (count($phones)) {
    ?>
			<ul class="phones unstyled">
				<?php 
    foreach ($phones as $phone) {
        ?>
				<li><?php 
        echo $phone;
        ?>
</li>
				<?php 
コード例 #4
0
ファイル: footer.php プロジェクト: rolandinsh/Pegasus-Theme
		<div id="footer">
			<div class="container wide">
				<div class="row" id="footer_stories">
					<div class="span12"><h2>More in This Issue</h2></div>
					
					<? 
					foreach(get_navigation_stories() as $story) {
					?> 
						<div class="span3">
							<a href="<?php 
echo get_permalink($story->ID);
?>
">
								<div class="thumb">
									<img src="<?php 
echo get_featured_image_url($story->ID);
?>
" />
								</div>
								<div class="title">
									<span class="title_text"><?php 
echo apply_filters('the_title', $story->post_title);
if (get_post_meta($story->ID, 'story_subtitle', True)) {
    ?>
: </span><span class="subtitle_text"><?php 
    echo get_post_meta($story->ID, 'story_subtitle', True);
    ?>
</span><?php 
} else {
    ?>
</span><?php