'',
), $atts));
$fixie = BJ::fixie($element);
return $fixie;
}
public static function browser_shot($attributes, $content = '', $code = '') {
extract(shortcode_atts(array(
'url' => '',
'width' => 250,
'target' => '_blank',
), $attributes));
$imageUrl = BJ_Shortcodes::bm_mshot($url, $width);
if ($imageUrl == '') {
return '';
} else {
$image = '
';
return '
';
}
}
/**
*
* @param string $url
* @param init $width
* @return string / false
*/
public static function bm_mshot($url = null, $width = 250) {
if (isset($url)) {
return 'http://s.wordpress.com/mshots/v1/' . urlencode(esc_url($url)) . '?w=' . $width;
} else {
return false;
}
}
public static function recent_posts($atts) {
extract(shortcode_atts(array(
'posts' => 1,
), $atts));
$return_string = '';
$args = array('orderby' => 'date', 'order' => 'DESC', 'showposts' => $posts);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
$return_string .= '- ' . get_the_title() . '
';
endwhile;
endif;
$return_string .= '
';
wp_reset_postdata();
return $return_string;
}
public static function related_post() {
//for use in the loop, list 5 post titles related to first tag on current post
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo 'Related Posts';
$first_tag = $tags[0]->term_id;
$args = array(
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'showposts' => 5,
'caller_get_posts' => 1
);
$my_query = new WP_Query($args);
if ($my_query->have_posts()) {
while ($my_query->have_posts()) : $my_query->the_post();
?>