Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • fernandobt,
    Thanks for your contribution! It is a good plugin!

    windwww

    (@windwww)

    This is a good and easy to use shortcode!

    windwww

    (@windwww)


    Above provides the solution:

    and I applied to this plugin:

    <?php
    /*
      Plugin Name: List Categories
      Plugin URI: https://github.com/picandocodigo/List-Categories
      Description: Simple plugin to display categories in any post or page
      with a shortcode. It's basically a shortcode API interface to the
      wp_list_categories WordPress function.
      Version: 0.1
      Author: Fernando Briano
      Author URI: https://picandocodigo.net/
    
      Copyright 2014  Fernando Briano  (email : [email protected])
    
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation; either version 3 of the License, or
      any later version.
    
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
    
      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    class ListCategories{
      static function list_categories($atts, $content = null) {
        ob_start();
    
        $atts = shortcode_atts(
          array(
            'show_option_all'    => '',
            'orderby'            => 'name',
            'order'              => 'ASC',
            'style'              => 'list',
            'show_count'         => 0,
            'hide_empty'         => 1,
            'use_desc_for_title' => 1,
            'child_of'           => 0,
            'feed'               => '',
            'feed_type'          => '',
            'feed_image'         => '',
            'exclude'            => '',
            'exclude_tree'       => '',
            'include'            => '',
            'hierarchical'       => 1,
            'title_li'           => __( 'Categories' ),
            'show_option_none'   => __( 'No categories' ),
            'number'             => null,
            'echo'               => 1,
            'depth'              => 0,
            'current_category'   => 0,
            'pad_counts'         => 0,
            'taxonomy'           => 'category',
            'walker'             => null
          ), $atts
        );
        wp_list_categories($atts);
        $output = ob_get_contents();
        ob_end_clean();
        return $output;
      }
    }
    
    add_shortcode( 'categories', array('ListCategories', 'list_categories') );
    
    ?>
    Thread Starter windwww

    (@windwww)

    I’ve check the database, and find that only table of Paid Memberships Pro are not encode in utf8. I changed the charset code for these tables and now it is work! I am not sure why? maybe there is something wrong about installation. Thanks for your reply!

    Thread Starter windwww

    (@windwww)

    amendment:

    $countPosts = null;
    			if(in_array("count",$params['show'])){
    				$countPosts = " (" . $subcategory->count .") ";
    			}
    			if(in_array("subcategory_name",$params['links'])){
    				$subcategory_name = "<a href=\"".get_category_link($subcategory->term_id)."\" class=\"pcig-subcategory-link\" title=\"".$subcategory->name."\">".$subcategory->name.$countPosts ."</a>";
    			}else{
    				$subcategory_name = $subcategory->name.$countPosts;
    			}

Viewing 5 replies - 1 through 5 (of 5 total)