return $title; }, 'post', array('length' => null, 'ending' => ' ...')); //////////////////// post_title /////////////////////////// //////////////////// post_content /////////////////////////// /* return post's description */ HEIBShortcode::add_shortcode('post_content', function ($attr) { $atts = HEIBShortcode::get_atts($attr); $post = heib_get_post(); if ($post) { $content = apply_filters('the_content', get_the_content()); $content = str_replace(']]>', ']]>', $content); //truncate content if (!is_null($atts['length']) && $atts['length'] > 0) { $content = heib_truncate($content, $atts['length'], array('ending' => $atts['ending'], 'exact' => false, 'html' => true)); } return $content; } else { return ''; } }, 'post', array('length' => 60, 'ending' => ' ...')); //////////////////// post_content /////////////////////////// //////////////////// post_comment_count /////////////////////////// /* return post comment count */ HEIBShortcode::add_shortcode('post_comment_count', function ($attr) { $atts = HEIBShortcode::get_atts($attr); $post = heib_get_post(); return $post ? $post->comment_count : $atts['empty'];
//setup default atts $atts = HEIBShortcode::get_atts($attr); $user = heib_get_user(); return get_avatar($user->ID, $atts['size']); }, 'user', array('size' => 80)); //////////////////// user_avatar /////////////////////////// //////////////////// user_link /////////////////////////// /* return user display link */ HEIBShortcode::add_shortcode('user_link', function ($attr) { $user = heib_get_user(); $atts = HEIBShortcode::get_atts($attr); $displayName = $user->display_name; if (!is_null($atts['length'])) { $displayName = heib_truncate($displayName, $atts['length'], array('ending' => $atts['ending'])); } return '<a href="' . get_author_posts_url($user->ID) . '">' . $displayName . '</a>'; }, 'user', array('length' => null, 'ending' => ' ...')); //////////////////// user_link /////////////////////////// //////////////////// user_url /////////////////////////// /* return user display link */ HEIBShortcode::add_shortcode('user_url', function ($attr) { $user = heib_get_user(); return get_author_posts_url($user->ID); }, 'user'); //////////////////// user_url /////////////////////////// //////////////////// user_recent_posts /////////////////////////// /*