示例#1
0
<article <?php 
post_class();
?>
>
	<figure class="col-xs-12 no-padding text-center post-thumbnail">
		<a class="story-img" href="<?php 
echo get_permalink();
?>
"><?php 
echo alfath_post_thumbnail($post_id);
?>
</a>
	</figure>
	<div class="summary-wrap col-xs-12">
		<header>
			<h4 class="entry-title"><a href="<?php 
the_permalink();
?>
"><?php 
the_title();
?>
</a></h4>
		</header>
		<div class="entry-summary">
			<?php 
the_excerpt();
?>
		</div>
	</div>
</article>
示例#2
0
/**
 * Shortcode function, display child page
 * @param  mixed $atts shortcodes attribute
 * @return string       html code - display shortcode
 */
function alfath_child_page($atts)
{
    global $post;
    $post_parent = $post->ID;
    ob_start();
    $args = array('post_parent' => $post_parent, 'post_type' => 'page', 'order' => 'DESC', 'orderby' => 'date', 'nopaging' => true);
    $query = new WP_Query($args);
    ?>

<?php 
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            ?>

<article class="child-page col-sm-12 col-xs-12 no-padding multi-columns-row">
	<figure class="<?php 
            echo is_sticky() ? 'sticky ' : '';
            ?>
col-xs-12 no-padding text-center post-thumbnail">
		<a class="story-img" href="<?php 
            echo get_permalink();
            ?>
"><?php 
            echo alfath_post_thumbnail($post_id);
            ?>
</a>
	</figure>
	<div class="<?php 
            echo is_sticky() ? 'sticky ' : '';
            ?>
summary-wrap col-xs-12">
		<header>
			<?php 
            if (is_sticky()) {
                ?>
				<h4 class="entry-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
			<?php 
            } else {
                ?>
				<h4 class="entry-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
			<?php 
            }
            ?>

		</header>
		<div class="entry-summary">
			<?php 
            if (function_exists('sharing_display')) {
                ?>
			<?php 
                remove_filter('the_excerpt', 'sharing_display', 19);
                ?>
			<?php 
            }
            ?>
			<?php 
            the_excerpt();
            ?>
		</div>
	</div>
</article>

<?php 
        }
        ?>
<!-- post navigation -->
<?php 
    } else {
        ?>
<!-- no posts found -->
<?php 
    }
    wp_reset_postdata();
    ?>

<?php 
    $output = ob_get_clean();
    return $output;
}