コード例 #1
0
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        /* Before widget (defined by themes). */
        $before_widget = str_replace('class="widget', 'class="widget share', $before_widget);
        echo $before_widget;
        /* Display Widget */
        /* Display the widget title if one was input (before and after defined by themes). */
        global $post;
        $main_image = '';
        if ($post != null) {
            $sc_post = new sc_post($post);
            $main_image = $sc_post->get_main_image();
        }
        ?>
			<ul class="boxed">
				<li class="light"><a target="_blank" href="https://twitter.com/intent/tweet?text=<?php 
        echo urlencode(SocialChef_Theme_Utils::get_current_page_url());
        ?>
" title="<?php 
        _e('Twitter', 'socialchef');
        ?>
"><i class="ico i-twitter"></i> <span><?php 
        _e('Share on Twitter', 'socialchef');
        ?>
</span></a></li>
				<li class="medium"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?display=popup&amp;u=<?php 
        echo urlencode(SocialChef_Theme_Utils::get_current_page_url());
        ?>
" title="<?php 
        _e('Facebook', 'socialchef');
        ?>
"><i class="ico i-facebook"></i> <span><?php 
        _e('Share on Facebook', 'socialchef');
        ?>
</span></a></li>
				<li class="dark"><a target="_blank"  href="http://pinterest.com/pin/create/button/?url=<?php 
        echo urlencode(SocialChef_Theme_Utils::get_current_page_url());
        ?>
&amp;media=<?php 
        echo esc_url($main_image);
        ?>
&amp;description=" title="<?php 
        _e('Pinterest', 'socialchef');
        ?>
"><i class="ico i-pinterest"></i> <span><?php 
        _e('Pin on Pinterest', 'socialchef');
        ?>
</span></a></li>
				<!--<li class="dark"><a href="#" title="Favourites"><i class="ico i-favourites"></i> <span>Add to Favourites</span></a></li>-->
			</ul>
		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
コード例 #2
0
ファイル: post-item.php プロジェクト: boutitinizar/bati-men
<?php

global $post, $sc_post_class;
$post_id = $post->ID;
$post_obj = new sc_post($post_id);
$post_comments = get_comments_number($post_id);
?>
<!--item-->
<div class="entry <?php 
echo esc_attr($sc_post_class);
?>
 post-item">
	<?php 
$main_image = $post_obj->get_main_image('thumb-image');
if (!empty($main_image)) {
    ?>
		<figure>
			<img src="<?php 
    echo esc_url($main_image);
    ?>
" alt="<?php 
    the_title();
    ?>
" />
			<figcaption><a href="<?php 
    echo esc_url($post_obj->get_permalink());
    ?>
"><i class="ico i-view"></i> <span><?php 
    _e('View post', 'socialchef');
    ?>
</span></a></figcaption>