return $post ? get_permalink() : ''; }, 'post'); //////////////////// post_link /////////////////////////// //////////////////// post_category_list /////////////////////////// /* return post category list */ HEIBShortcode::add_shortcode('post_category_list', function ($attr) { $atts = HEIBShortcode::get_atts($attr); $post = heib_get_post(); $content = ''; if ($post) { $content = __(get_the_category_list($atts['separator'], $atts['parents'])); } return $content ? $content : $atts['empty']; }, 'post', array('separator' => null, 'parents' => '', 'empty' => __('N/A'))); //////////////////// post_category_list /////////////////////////// //////////////////// post_tag_list /////////////////////////// /* return post tag list */ HEIBShortcode::add_shortcode('post_tag_list', function ($attr) { $atts = HEIBShortcode::get_atts($attr); $post = heib_get_post(); $content = ''; if ($post) { $content = __(get_the_tag_list($atts['separator'], $atts['parents'])); } return $content ? $content : $atts['empty']; }, 'post', array('separator' => null, 'parents' => '', 'empty' => __('N/A'))); //////////////////// post_tag_list ///////////////////////////
private function shortcodeHooks() { require_once dirname(__FILE__) . '/includes/shortcodes.php'; HEIBShortcode::init(); }
public function do_shortcode($att, $content, $tag) { HEIBShortcode::setCurrentShortCode($this); $content = call_user_func_array($this->fn, array($att, $content, $tag)); HEIBShortcode::popCurrentShortCode(); return $content; }
global $shortcode_tags; $query = $res->query(); if (!isset($query['shortcode'])) { $res->error = 3; $res->errMsg = 'No shortcode provided'; } else { $shortcode = $query['shortcode']; $content = do_shortcode(stripslashes($shortcode)); $res->data = $content; } return $res; }); /* get shortcode list endpoint */ add_filter('heib_process_endpoint__shortcodes.get', function ($res) { $query = $res->query(); $boxType = $query['type'] ? $query['type'] : ''; $shortcodes = HEIBShortcode::getBoxShortcodes($boxType); $shortcodes = array_map(function ($s) { $obj = new stdClass(); $obj->title = $s['name']; $obj->value = $s['name']; $obj->atts = $s['atts']; $obj->hints = $s['hints']; return $obj; }, $shortcodes); $res->data = $shortcodes; return $res; }); //////////////////// End Shortcode Endpoints ///////////////////////