示例#1
0
        post_class('u-clear');
        ?>
>

						<?php 
        if (is_singular()) {
            ?>
							<h1><?php 
            the_title();
            ?>
</h1>
						<?php 
        } else {
            ?>
							<img src="<?php 
            echo allonsy_get_post_img_url();
            ?>
" class="alignleft">
							<h2><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h2>
						<?php 
        }
        ?>

						<div class="has-wysiwyg">
    /**
     * Build hard-coded sharing icons
     *
     * @param int    $pid
     * @param string $title
     * @param string $img
     */
    function allonsy_share_links($pid = 0, $title = '', $img = '')
    {
        // Default to current post globals
        if (empty($pid)) {
            $pid = get_the_ID();
        }
        if (empty($title)) {
            $title = get_the_title($pid);
        }
        if (empty($img)) {
            $img = allonsy_get_post_img_url($pid);
        }
        $permalink = get_permalink($pid);
        $sharing = [];
        // Twitter sharing
        $sharing['twitter'] = sprintf('https://twitter.com/intent/tweet?text=%s&url=%s', urlencode($title), urlencode($permalink));
        // LinkedIn sharing
        $sharing['linkedin'] = sprintf('http://www.linkedin.com/shareArticle?mini=true&title=%s&url=%s', urlencode($title), urlencode($permalink));
        // Pinterest sharing
        $sharing['pinterest'] = sprintf('http://pinterest.com/pin/create/button/?url=%s&image_url=%s&description=%s', urlencode($permalink), urlencode($img), urlencode($title));
        // Facebook sharing
        $sharing['facebook'] = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($permalink);
        // Google Plus sharing
        $sharing['gplus'] = 'https://plus.google.com/share?url=' . urlencode($permalink);
        foreach (['twitter', 'facebook', 'pinterest'] as $network) {
            printf('<a href="%s" target="_blank" rel="nofollow" class="bt-share bt-share__%s">
					<i class="icon icon-%s bt-sharing--icon"></i></a>', esc_url($sharing[$network]), $network, $network);
        }
    }