Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- This snippet will add new shortcode [tags_list]
- */
- function em_get_tags_shortcode(){
- $args = (array) $args;
- $args['ajax'] = isset($args['ajax']) ? $args['ajax']:(!defined('EM_AJAX') || EM_AJAX );
- $args['format'] = ($format != '' || empty($args['format'])) ? $format : $args['format'];
- $args['format'] = html_entity_decode($args['format']); //shorcode doesn't accept html
- $args['orderby'] = !empty($args['orderby']) ? $args['orderby'] : get_option('dbem_categories_default_orderby');
- $args['order'] = !empty($args['order']) ? $args['order'] : get_option('dbem_categories_default_order');
- $args['pagination'] = isset($args['pagination']) ? $args['pagination'] : !isset($args['limit']);
- $args['limit'] = isset($args['limit']) ? $args['limit'] : get_option('dbem_categories_default_limit');
- if( !empty($args['id']) ) $args['id'] = rand(100, getrandmax());
- if( empty($args['format']) && empty($args['format_header']) && empty($args['format_footer']) ){
- ob_start();
- if( !empty($args['ajax']) ){ echo '<div class="em-search-ajax">'; } //open AJAX wrapper
- em_locate_template('templates/tags-list.php', true, array('args'=>$args));
- if( !empty($args['ajax']) ) echo "</div>"; //close AJAX wrapper
- $return = ob_get_clean();
- }else{
- $args['ajax'] = false;
- $args['page'] = ( !empty($args['pagination']) && !empty($args['page']) && is_numeric($args['page']) )? $args['page'] : 1;
- $args['page'] = ( !empty($args['pagination']) && !empty($_GET['pno']) && is_numeric($_GET['pno']) )? $_GET['pno'] : $args['page'];
- $return = EM_Tags::output($args);
- }
- return $return;
- }
- add_shortcode ( 'tags_list', 'em_get_tags_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement