Plugin Directory

Changeset 1791236


Ignore:
Timestamp:
12/22/2017 12:04:44 PM (8 years ago)
Author:
manishamakhija
Message:

text domain changed

Location:
taxonomy-term-listing-visual-composer-addon
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • taxonomy-term-listing-visual-composer-addon/tags/1.1/readme.txt

    r1790651 r1791236  
    11=== Taxonomy Term List Visual Composer Addon ===
    22Plugin Name: Taxonomy Term List Visual Composer Addon
    3 Plugin URI: http://krishaweb.com/
    4 Author: krishaweb
    5 Author URI: http://krishaweb.com/
     3Plugin URI: https://wordpress.org/plugins/taxonomy-term-listing-visual-composer-addon/
    64Contributors: krishaweb, manishamakhija
    75Tags: category List,taxonomy list,term list,nested term list
  • taxonomy-term-listing-visual-composer-addon/tags/1.1/taxonomy-listing-vc-addon.php

    r1790680 r1791236  
    22/*
    33Plugin Name: Taxonomy Term Listing - Visual Composer Addon
     4Author: Manisha Makhija
     5Author URI: https://profiles.wordpress.org/manishamakhija
    46Version: 1.1
    57Description: Creates nested list of categories
    6 Author:
    7 Author URI:
    8 Text Domain: taxonomy-term-list-addon
     8Text Domain: taxonomy-term-listing-visual-composer-addon
    99Domain path: /languages
    1010*/
     
    3131// Admin notice for required visual composer.
    3232function admin_notice_tlvs_activation(){
    33   echo '<div class="error"><p>' . __('The <strong>Taxonomy Listing Visual Composer addon </strong> requires <strong>Visual Composer</strong> installed and activated.') . '</p></div>';
     33  echo '<div class="error"><p>' . __('The <strong>Taxonomy Term Listing Visual Composer addon </strong> requires <strong>Visual Composer</strong> installed and activated.','taxonomy-term-listing-visual-composer-addon') . '</p></div>';
    3434}
    3535
  • taxonomy-term-listing-visual-composer-addon/tags/1.1/taxonomy-listing.php

    r1790680 r1791236  
    11<?php
    22
    3 class Taxonomy_Term_Addon {
    4 
    5   // Constructor for the taxonomy term listing. Loads options and hooks in the init method.
    6   public function __construct() {
    7     add_action( 'vc_before_init', array( $this, 'termlisting' ) );
    8     add_action( 'plugins_loaded', array( $this,'taxonomy_listing_addon_load_textdomain' ) );
    9   }
    10 
    11   // Include or mapping
    12   function termlisting() {
    13     vc_map( array(
    14       'name' => __('Taxonomy Term Listing','taxonomy-term-list-addon'),
    15       'base' => 'taxonomy_term',
    16       'icon' => TAXONOMY_LISTING_ADDON_PLUGIN_URL . '/images/icon-taxonomy-listing.png',
    17       'class' => '',
    18       'category' => 'Content',
    19       'params' => array(
    20         array(
    21           'type' => 'Taxonomy_Names',
    22           'holder' => 'div',
    23           'class' => '',
    24           'heading' => __( '', 'taxonomy-term-list-addon' ),
    25           'param_name' => 'taxonomy_names',
    26           'value' => '',
    27           'description' => __('Select desired taxonomy name','taxonomy-term-list-addon'),
    28         ),
    29         array(
    30           'type' => 'dropdown',
    31           'class' => '',
    32           'heading' => __( '', 'taxonomy-term-list-addon' ),
    33           'param_name' => 'order',
    34           'value' => array(
    35             'Ascending' => 'ASC',
    36             'Descending' => 'DESC'
    37           ),
    38           'description' => '',
    39         ),
    40         array(
    41           'type' => 'include_child_category',
    42           'class' => '',
    43           'heading' => __( '', 'taxonomy-term-list-addon' ),
    44           'param_name' => 'include_subcategory',
    45           'value' => '',
    46           'description' => '',
    47           'admin_label' => 'false',
    48         ),
    49         array(
    50           'type' => 'count_display',
    51           'class' => '',
    52           'heading' => __( '', 'taxonomy-term-list-addon' ),
    53           'param_name' => 'count',
    54           'value' => '',
    55           'description' => '',
    56           'admin_label' => 'false',
    57         ),
    58         array(
    59           'type' => 'Hide_empty',
    60           'class' => '',
    61           'heading' => __( '', 'taxonomy-term-list-addon' ),
    62           'param_name' => 'hide_empty',
    63           'value' => '',
    64           'description' => '',
    65           'admin_label' => 'false',
    66         ),
    67         array(
    68           'type' => 'specific_subcategory',
    69           'class' => '',
    70           'heading' => __('Enter Parent term Id','taxonomy-term-list-addon'),
    71           'param_name' => 'specific_subcategory',
    72           'value' => '',
    73           'description' => __('include any specific subcategory','taxonomy-term-list-addon'),
    74           'admin_label' => 'false',
    75         ),
    76         array(
    77           'type' => 'textfield',
    78           'class' => '',
    79           'heading' => __('Extra Class Name','taxonomy-term-list-addon'),
    80           'param_name' => 'extra_class_name',
    81           'value' => '',
    82           'description' => __('For styling any particular element','taxonomy-term-list-addon'),
    83           'admin_label' => 'false',
    84         ),
    85       )
    86     ) );
    87   }
    88 
    89   function taxonomy_name_settings_field( $settings, $value ) {
    90     $data = '<div class="taxonomy_name_list">' . '<select name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
    91     $data .= '<option value="">'.__('Select Taxonomy','taxonomy-term-list-addon').'</option>';
    92     $post_types = get_post_types( array( 'public' => true ) );
    93     foreach ( $post_types as $key => $post_type_name ) {
    94       $taxonomy_names = get_object_taxonomies( $post_type_name );
    95       foreach( $taxonomy_names as $taxonomy_name ) {
    96         $data .= '<option value="' . $taxonomy_name . '"' . ( ( $taxonomy_name == $value ) ? 'selected' : '' ) . '>' . $taxonomy_name . '</option>';   
     3if ( !class_exists( 'Taxonomy_Term_Addon' ) ) {
     4  class Taxonomy_Term_Addon {
     5
     6    // Constructor for the taxonomy term listing. Loads options and hooks in the init method.
     7    public function __construct() {
     8      add_action( 'vc_before_init', array( $this, 'termlisting' ) );
     9      add_action( 'plugins_loaded', array( $this,'taxonomy_listing_addon_load_textdomain' ) );
     10    }
     11
     12    // Include or mapping
     13    function termlisting() {
     14      vc_map( array(
     15        'name' => __('Taxonomy Term Listing','taxonomy-term-listing-visual-composer-addon'),
     16        'base' => 'taxonomy_term',
     17        'icon' => TAXONOMY_LISTING_ADDON_PLUGIN_URL . '/images/icon-taxonomy-listing.png',
     18        'class' => '',
     19        'category' => 'Content',
     20        'params' => array(
     21          array(
     22            'type' => 'Taxonomy_Names',
     23            'holder' => 'div',
     24            'class' => '',
     25            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     26            'param_name' => 'taxonomy_names',
     27            'value' => '',
     28            'description' => __('Select desired taxonomy name','taxonomy-term-listing-visual-composer-addon'),
     29          ),
     30          array(
     31            'type' => 'dropdown',
     32            'class' => '',
     33            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     34            'param_name' => 'order',
     35            'value' => array(
     36              'Ascending' => 'ASC',
     37              'Descending' => 'DESC'
     38            ),
     39            'description' => '',
     40          ),
     41          array(
     42            'type' => 'include_child_category',
     43            'class' => '',
     44            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     45            'param_name' => 'include_subcategory',
     46            'value' => '',
     47            'description' => '',
     48            'admin_label' => 'false',
     49          ),
     50          array(
     51            'type' => 'count_display',
     52            'class' => '',
     53            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     54            'param_name' => 'count',
     55            'value' => '',
     56            'description' => '',
     57            'admin_label' => 'false',
     58          ),
     59          array(
     60            'type' => 'Hide_empty',
     61            'class' => '',
     62            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     63            'param_name' => 'hide_empty',
     64            'value' => '',
     65            'description' => '',
     66            'admin_label' => 'false',
     67          ),
     68          array(
     69            'type' => 'specific_subcategory',
     70            'class' => '',
     71            'heading' => __('Enter Parent term Id','taxonomy-term-listing-visual-composer-addon'),
     72            'param_name' => 'specific_subcategory',
     73            'value' => '',
     74            'description' => __('include any specific subcategory','taxonomy-term-listing-visual-composer-addon'),
     75            'admin_label' => 'false',
     76          ),
     77          array(
     78            'type' => 'textfield',
     79            'class' => '',
     80            'heading' => __('Extra Class Name','taxonomy-term-listing-visual-composer-addon'),
     81            'param_name' => 'extra_class_name',
     82            'value' => '',
     83            'description' => __('For styling any particular element','taxonomy-term-listing-visual-composer-addon'),
     84            'admin_label' => 'false',
     85          ),
     86        )
     87      ) );
     88    }
     89
     90    function taxonomy_name_settings_field( $settings, $value ) {
     91      $data = '<div class="taxonomy_name_list">' . '<select name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
     92      $data .= '<option value="">'.__('Select Taxonomy','taxonomy-term-listing-visual-composer-addon').'</option>';
     93      $post_types = get_post_types( array( 'public' => true ) );
     94      foreach ( $post_types as $key => $post_type_name ) {
     95        $taxonomy_names = get_object_taxonomies( $post_type_name );
     96        foreach( $taxonomy_names as $taxonomy_name ) {
     97          $data .= '<option value="' . $taxonomy_name . '"' . ( ( $taxonomy_name == $value ) ? 'selected' : '' ) . '>' . $taxonomy_name . '</option>';   
     98        }
    9799      }
    98     }
    99     $data .= '</select>' . '</div>'; ?>
    100     <script>
    101     (function( $ ) {
    102       jQuery('.taxonomy_name_list select').change(function(){
    103         var taxonomyValue = {
    104           action: "get_taxonomy_term_id",
    105           postdata: jQuery('.taxonomy_name_list select').val()
    106         }
    107         jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue, function( response ) {
    108           jQuery('.parent_id_list select').empty().append(response);       
    109         } );
    110       });
    111       if ( jQuery('.taxonomy_name_list select').val() != "" ) {
    112         var taxonomyValue1 = {
    113           action: "get_taxonomy_term_id",
    114           postdata_selected: jQuery('.taxonomy_name_list select').val(),
    115           postdata_termselected: jQuery('.parent_id_list select').val()
    116         }
    117         jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue1, function( response ) {
    118           jQuery('.parent_id_list select').empty().append(response);       
    119         } );
     100      $data .= '</select>' . '</div>'; ?>
     101      <script>
     102      (function( $ ) {
     103        jQuery('.taxonomy_name_list select').change(function(){
     104          var taxonomyValue = {
     105            action: "get_taxonomy_term_id",
     106            postdata: jQuery('.taxonomy_name_list select').val()
     107          }
     108          jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue, function( response ) {
     109            jQuery('.parent_id_list select').empty().append(response);       
     110          } );
     111        });
     112        if ( jQuery('.taxonomy_name_list select').val() != "" ) {
     113          var taxonomyValue1 = {
     114            action: "get_taxonomy_term_id",
     115            postdata_selected: jQuery('.taxonomy_name_list select').val(),
     116            postdata_termselected: jQuery('.parent_id_list select').val()
     117          }
     118          jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue1, function( response ) {
     119            jQuery('.parent_id_list select').empty().append(response);       
     120          } );
     121        }
     122      })( jQuery );
     123      </script>
     124      <?php return $data;
     125    }
     126   
     127    function include_child_settings_field( $settings, $value ) {
     128      $include_child_categories = '<div class="include-child"><input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('include Subcategory','taxonomy-term-listing-visual-composer-addon'). '</div>'; ?>
     129      <script>
     130      (function( $ ) {
     131        jQuery( 'input[name="include_subcategory"]' ).on( 'change', function() {
     132          this.value = this.checked ? 1 : 0 ;
     133        });
     134      })( jQuery );
     135      </script>
     136      <?php return $include_child_categories;
     137    }
     138
     139    function count_display_settings_field( $settings, $value ) {
     140      $include_count_display = '<div class="include-count"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('show count','taxonomy-term-listing-visual-composer-addon') . '</div>'; ?>
     141      <script>
     142      (function( $ ) {
     143        jQuery( 'input[name="count"]' ).on( 'change', function() {
     144          this.value = this.checked ? 1 : 0 ;
     145        });
     146      })( jQuery );
     147      </script>
     148      <?php return $include_count_display;
     149    }
     150
     151    function hide_empty_settings_field( $settings, $value ){
     152      $hide_empty_cat = '<div class="hide_empty_main"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('Hide Empty Category','taxonomy-term-listing-visual-composer-addon') . '</div>'; ?>
     153      <script>
     154      (function( $ ) {
     155        jQuery( 'input[name="hide_empty"]' ).on( 'change', function() {
     156          this.value = this.checked ? 1 : 0 ;
     157        });
     158      })( jQuery );
     159      </script>
     160      <?php return $hide_empty_cat;
     161    }
     162
     163    function specific_subcategory_settings_field( $settings, $value ) {
     164      $specific_cat = '<div class="parent_id_list">' . '<select name="'. esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
     165      $specific_cat .= '<option value="' . $value . '">'.__('Select Taxonomy first','taxonomy-term-listing-visual-composer-addon').'</option>'; 
     166      $specific_cat .= '</select>' . '</div>';
     167      return $specific_cat;
     168    }
     169
     170      // Load plugin textdomain.
     171    function taxonomy_listing_addon_load_textdomain() {
     172      load_plugin_textdomain( 'taxonomy-term-listing-visual-composer-addon', false, basename( dirname( __FILE__ ) ) . '/languages' );
     173    }
     174
     175    // frontend view
     176    function term_listing_func( $atts ) {
     177      $specific_subcategory = isset( $atts['specific_subcategory'] ) ? $atts['specific_subcategory'] : 0 ;
     178      $order_attr = ( isset( $atts['order'] ) ? $atts['order'] : 'ASC' );
     179      $taxonomy_names_attr = ( isset( $atts['taxonomy_names'] ) ? $atts['taxonomy_names'] : NULL );
     180      $class = ( isset( $atts['extra_class_name']) ? "class = ".$atts['extra_class_name'] : "");
     181      $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent'=> 0 );
     182      if ( isset( $atts['specific_subcategory'] ) || $atts['include_subcategory'] == 1 ) {
     183        if ( isset( $atts['specific_subcategory'] ) ) {
     184          $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $specific_subcategory );
     185        }
     186        $term = get_terms( $taxonomy_names_attr,$arguments );
     187        $response = '';
     188        $response = '<div class="vc_taxonomy_listing">';
     189        $response .= '<ul ' . $class . '>';
     190        foreach( $term as $terms ) {
     191          $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name.( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a>';
     192          if ( isset( $atts['specific_subcategory'] ) ? ( $terms->parent != 0 ) : ( $terms->parent == 0 ) ) {
     193            $response .= '<ul>';
     194            $arg_inner = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $terms->term_id );
     195            $child_terms = get_terms( $taxonomy_names_attr, $arg_inner );
     196            foreach( $child_terms as $child_term ) {
     197              $response .= '<li><a href="' . get_term_link( $child_term->term_id ) . '">' . $child_term->name.( $atts['count'] == 1 ? '(' . $child_term->count . ')' : '') . '</a>';
     198              if ( $child_term->parent != 0 ) {
     199                $response .= '<ul>';
     200                $arg_inner_child = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $child_term->term_id );
     201                $inner_child_terms = get_terms( $taxonomy_names_attr, $arg_inner_child );
     202                foreach( $inner_child_terms as $inner_child_term ) {
     203                  $response .= '<li><a href="' . get_term_link( $inner_child_term->term_id ) . '">' . $inner_child_term->name.( $atts['count'] == 1 ? '(' . $inner_child_term->count . ')' : '') . '</a></li>';
     204                }
     205                $response .= '</ul>';
     206              }
     207            }
     208            $response .= '</ul></li>';
     209          }
     210        }
     211        $response .= '</ul>';
     212        return $response;
     213      } else {
     214        $term = get_terms( $taxonomy_names_attr,$arguments );
     215        $response = '';
     216        $response = '<ul>';
     217        foreach ($term as $terms ){
     218          $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name . ( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a></li>';
     219        }
     220        $response .= '</ul>';
     221        $response .= '</div>';
     222        return $response;
    120223      }
    121     })( jQuery );
    122     </script>
    123     <?php return $data;
    124   }
    125  
    126   function include_child_settings_field( $settings, $value ) {
    127     $include_child_categories = '<div class="include-child"><input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('include Subcategory','taxonomy-term-list-addon'). '</div>'; ?>
    128     <script>
    129     (function( $ ) {
    130       jQuery( 'input[name="include_subcategory"]' ).on( 'change', function() {
    131         this.value = this.checked ? 1 : 0 ;
    132       });
    133     })( jQuery );
    134     </script>
    135     <?php return $include_child_categories;
    136   }
    137 
    138   function count_display_settings_field( $settings, $value ) {
    139     $include_count_display = '<div class="include-count"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('show count','taxonomy-term-list-addon') . '</div>'; ?>
    140     <script>
    141     (function( $ ) {
    142       jQuery( 'input[name="count"]' ).on( 'change', function() {
    143         this.value = this.checked ? 1 : 0 ;
    144       });
    145     })( jQuery );
    146     </script>
    147     <?php return $include_count_display;
    148   }
    149 
    150   function hide_empty_settings_field( $settings, $value ){
    151     $hide_empty_cat = '<div class="hide_empty_main"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('Hide Empty Category','taxonomy-term-list-addon') . '</div>'; ?>
    152     <script>
    153     (function( $ ) {
    154       jQuery( 'input[name="hide_empty"]' ).on( 'change', function() {
    155         this.value = this.checked ? 1 : 0 ;
    156       });
    157     })( jQuery );
    158     </script>
    159     <?php return $hide_empty_cat;
    160   }
    161 
    162   function specific_subcategory_settings_field( $settings, $value ) {
    163     $specific_cat = '<div class="parent_id_list">' . '<select name="'. esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
    164     $specific_cat .= '<option value="' . $value . '">'.__('Select Taxonomy first','taxonomy-term-list-addon').'</option>'; 
    165     $specific_cat .= '</select>' . '</div>';
    166     return $specific_cat;
    167   }
    168 
    169     // Load plugin textdomain.
    170   function taxonomy_listing_addon_load_textdomain() {
    171     load_plugin_textdomain( 'taxonomy-term-list-addon', false, basename( dirname( __FILE__ ) ) . '/languages' );
    172   }
    173 
    174   // frontend view
    175   function term_listing_func( $atts ) {
    176     $specific_subcategory = isset( $atts['specific_subcategory'] ) ? $atts['specific_subcategory'] : 0 ;
    177     $order_attr = ( isset( $atts['order'] ) ? $atts['order'] : 'ASC' );
    178     $taxonomy_names_attr = ( isset( $atts['taxonomy_names'] ) ? $atts['taxonomy_names'] : NULL );
    179     $class = ( isset( $atts['extra_class_name']) ? "class = ".$atts['extra_class_name'] : "");
    180     $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent'=> 0 );
    181     if ( isset( $atts['specific_subcategory'] ) || $atts['include_subcategory'] == 1 ) {
    182       if ( isset( $atts['specific_subcategory'] ) ) {
    183         $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $specific_subcategory );
    184       }
    185       $term = get_terms( $taxonomy_names_attr,$arguments );
    186       $response = '';
    187       $response = '<div class="vc_taxonomy_listing">';
    188       $response .= '<ul ' . $class . '>';
    189       foreach( $term as $terms ) {
    190         $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name.( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a>';
    191         if ( isset( $atts['specific_subcategory'] ) ? ( $terms->parent != 0 ) : ( $terms->parent == 0 ) ) {
    192           $response .= '<ul>';
    193           $arg_inner = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $terms->term_id );
    194           $child_terms = get_terms( $taxonomy_names_attr, $arg_inner );
    195           foreach( $child_terms as $child_term ) {
    196             $response .= '<li><a href="' . get_term_link( $child_term->term_id ) . '">' . $child_term->name.( $atts['count'] == 1 ? '(' . $child_term->count . ')' : '') . '</a>';
    197             if ( $child_term->parent != 0 ) {
    198               $response .= '<ul>';
    199               $arg_inner_child = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $child_term->term_id );
    200               $inner_child_terms = get_terms( $taxonomy_names_attr, $arg_inner_child );
    201               foreach( $inner_child_terms as $inner_child_term ) {
    202                 $response .= '<li><a href="' . get_term_link( $inner_child_term->term_id ) . '">' . $inner_child_term->name.( $atts['count'] == 1 ? '(' . $inner_child_term->count . ')' : '') . '</a></li>';
    203               }
    204               $response .= '</ul>';
    205             }
    206           }
    207           $response .= '</ul></li>';
    208         }
    209       }
    210       $response .= '</ul>';
    211       return $response;
    212     } else {
    213       $term = get_terms( $taxonomy_names_attr,$arguments );
    214       $response = '';
    215       $response = '<ul>';
    216       foreach ($term as $terms ){
    217         $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name . ( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a></li>';
    218       }
    219       $response .= '</ul>';
    220       $response .= '</div>';
    221       return $response;
    222224    }
    223225  }
    224226}
    225 // Create obj of class.
     227// Instantiate our class
    226228$taxonomy_listing_obj = new Taxonomy_Term_Addon(); 
    227229vc_add_shortcode_param( 'Taxonomy_Names',  array($taxonomy_listing_obj, 'taxonomy_name_settings_field' ) );
  • taxonomy-term-listing-visual-composer-addon/trunk/readme.txt

    r1789454 r1791236  
    11=== Taxonomy Term List Visual Composer Addon ===
    22Plugin Name: Taxonomy Term List Visual Composer Addon
    3 Plugin URI: http://krishaweb.com/
    4 Author: krishaweb
    5 Author URI: http://krishaweb.com/
     3Plugin URI: https://wordpress.org/plugins/taxonomy-term-listing-visual-composer-addon/
    64Contributors: krishaweb, manishamakhija
    75Tags: category List,taxonomy list,term list,nested term list
  • taxonomy-term-listing-visual-composer-addon/trunk/taxonomy-listing-vc-addon.php

    r1790680 r1791236  
    22/*
    33Plugin Name: Taxonomy Term Listing - Visual Composer Addon
     4Author: Manisha Makhija
     5Author URI: https://profiles.wordpress.org/manishamakhija
    46Version: 1.1
    57Description: Creates nested list of categories
    6 Author:
    7 Author URI:
    8 Text Domain: taxonomy-term-list-addon
     8Text Domain: taxonomy-term-listing-visual-composer-addon
    99Domain path: /languages
    1010*/
     
    3131// Admin notice for required visual composer.
    3232function admin_notice_tlvs_activation(){
    33   echo '<div class="error"><p>' . __('The <strong>Taxonomy Listing Visual Composer addon </strong> requires <strong>Visual Composer</strong> installed and activated.') . '</p></div>';
     33  echo '<div class="error"><p>' . __('The <strong>Taxonomy Term Listing Visual Composer addon </strong> requires <strong>Visual Composer</strong> installed and activated.','taxonomy-term-listing-visual-composer-addon') . '</p></div>';
    3434}
    3535
  • taxonomy-term-listing-visual-composer-addon/trunk/taxonomy-listing.php

    r1790680 r1791236  
    11<?php
    22
    3 class Taxonomy_Term_Addon {
    4 
    5   // Constructor for the taxonomy term listing. Loads options and hooks in the init method.
    6   public function __construct() {
    7     add_action( 'vc_before_init', array( $this, 'termlisting' ) );
    8     add_action( 'plugins_loaded', array( $this,'taxonomy_listing_addon_load_textdomain' ) );
    9   }
    10 
    11   // Include or mapping
    12   function termlisting() {
    13     vc_map( array(
    14       'name' => __('Taxonomy Term Listing','taxonomy-term-list-addon'),
    15       'base' => 'taxonomy_term',
    16       'icon' => TAXONOMY_LISTING_ADDON_PLUGIN_URL . '/images/icon-taxonomy-listing.png',
    17       'class' => '',
    18       'category' => 'Content',
    19       'params' => array(
    20         array(
    21           'type' => 'Taxonomy_Names',
    22           'holder' => 'div',
    23           'class' => '',
    24           'heading' => __( '', 'taxonomy-term-list-addon' ),
    25           'param_name' => 'taxonomy_names',
    26           'value' => '',
    27           'description' => __('Select desired taxonomy name','taxonomy-term-list-addon'),
    28         ),
    29         array(
    30           'type' => 'dropdown',
    31           'class' => '',
    32           'heading' => __( '', 'taxonomy-term-list-addon' ),
    33           'param_name' => 'order',
    34           'value' => array(
    35             'Ascending' => 'ASC',
    36             'Descending' => 'DESC'
    37           ),
    38           'description' => '',
    39         ),
    40         array(
    41           'type' => 'include_child_category',
    42           'class' => '',
    43           'heading' => __( '', 'taxonomy-term-list-addon' ),
    44           'param_name' => 'include_subcategory',
    45           'value' => '',
    46           'description' => '',
    47           'admin_label' => 'false',
    48         ),
    49         array(
    50           'type' => 'count_display',
    51           'class' => '',
    52           'heading' => __( '', 'taxonomy-term-list-addon' ),
    53           'param_name' => 'count',
    54           'value' => '',
    55           'description' => '',
    56           'admin_label' => 'false',
    57         ),
    58         array(
    59           'type' => 'Hide_empty',
    60           'class' => '',
    61           'heading' => __( '', 'taxonomy-term-list-addon' ),
    62           'param_name' => 'hide_empty',
    63           'value' => '',
    64           'description' => '',
    65           'admin_label' => 'false',
    66         ),
    67         array(
    68           'type' => 'specific_subcategory',
    69           'class' => '',
    70           'heading' => __('Enter Parent term Id','taxonomy-term-list-addon'),
    71           'param_name' => 'specific_subcategory',
    72           'value' => '',
    73           'description' => __('include any specific subcategory','taxonomy-term-list-addon'),
    74           'admin_label' => 'false',
    75         ),
    76         array(
    77           'type' => 'textfield',
    78           'class' => '',
    79           'heading' => __('Extra Class Name','taxonomy-term-list-addon'),
    80           'param_name' => 'extra_class_name',
    81           'value' => '',
    82           'description' => __('For styling any particular element','taxonomy-term-list-addon'),
    83           'admin_label' => 'false',
    84         ),
    85       )
    86     ) );
    87   }
    88 
    89   function taxonomy_name_settings_field( $settings, $value ) {
    90     $data = '<div class="taxonomy_name_list">' . '<select name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
    91     $data .= '<option value="">'.__('Select Taxonomy','taxonomy-term-list-addon').'</option>';
    92     $post_types = get_post_types( array( 'public' => true ) );
    93     foreach ( $post_types as $key => $post_type_name ) {
    94       $taxonomy_names = get_object_taxonomies( $post_type_name );
    95       foreach( $taxonomy_names as $taxonomy_name ) {
    96         $data .= '<option value="' . $taxonomy_name . '"' . ( ( $taxonomy_name == $value ) ? 'selected' : '' ) . '>' . $taxonomy_name . '</option>';   
     3if ( !class_exists( 'Taxonomy_Term_Addon' ) ) {
     4  class Taxonomy_Term_Addon {
     5
     6    // Constructor for the taxonomy term listing. Loads options and hooks in the init method.
     7    public function __construct() {
     8      add_action( 'vc_before_init', array( $this, 'termlisting' ) );
     9      add_action( 'plugins_loaded', array( $this,'taxonomy_listing_addon_load_textdomain' ) );
     10    }
     11
     12    // Include or mapping
     13    function termlisting() {
     14      vc_map( array(
     15        'name' => __('Taxonomy Term Listing','taxonomy-term-listing-visual-composer-addon'),
     16        'base' => 'taxonomy_term',
     17        'icon' => TAXONOMY_LISTING_ADDON_PLUGIN_URL . '/images/icon-taxonomy-listing.png',
     18        'class' => '',
     19        'category' => 'Content',
     20        'params' => array(
     21          array(
     22            'type' => 'Taxonomy_Names',
     23            'holder' => 'div',
     24            'class' => '',
     25            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     26            'param_name' => 'taxonomy_names',
     27            'value' => '',
     28            'description' => __('Select desired taxonomy name','taxonomy-term-listing-visual-composer-addon'),
     29          ),
     30          array(
     31            'type' => 'dropdown',
     32            'class' => '',
     33            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     34            'param_name' => 'order',
     35            'value' => array(
     36              'Ascending' => 'ASC',
     37              'Descending' => 'DESC'
     38            ),
     39            'description' => '',
     40          ),
     41          array(
     42            'type' => 'include_child_category',
     43            'class' => '',
     44            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     45            'param_name' => 'include_subcategory',
     46            'value' => '',
     47            'description' => '',
     48            'admin_label' => 'false',
     49          ),
     50          array(
     51            'type' => 'count_display',
     52            'class' => '',
     53            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     54            'param_name' => 'count',
     55            'value' => '',
     56            'description' => '',
     57            'admin_label' => 'false',
     58          ),
     59          array(
     60            'type' => 'Hide_empty',
     61            'class' => '',
     62            'heading' => __( '', 'taxonomy-term-listing-visual-composer-addon' ),
     63            'param_name' => 'hide_empty',
     64            'value' => '',
     65            'description' => '',
     66            'admin_label' => 'false',
     67          ),
     68          array(
     69            'type' => 'specific_subcategory',
     70            'class' => '',
     71            'heading' => __('Enter Parent term Id','taxonomy-term-listing-visual-composer-addon'),
     72            'param_name' => 'specific_subcategory',
     73            'value' => '',
     74            'description' => __('include any specific subcategory','taxonomy-term-listing-visual-composer-addon'),
     75            'admin_label' => 'false',
     76          ),
     77          array(
     78            'type' => 'textfield',
     79            'class' => '',
     80            'heading' => __('Extra Class Name','taxonomy-term-listing-visual-composer-addon'),
     81            'param_name' => 'extra_class_name',
     82            'value' => '',
     83            'description' => __('For styling any particular element','taxonomy-term-listing-visual-composer-addon'),
     84            'admin_label' => 'false',
     85          ),
     86        )
     87      ) );
     88    }
     89
     90    function taxonomy_name_settings_field( $settings, $value ) {
     91      $data = '<div class="taxonomy_name_list">' . '<select name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
     92      $data .= '<option value="">'.__('Select Taxonomy','taxonomy-term-listing-visual-composer-addon').'</option>';
     93      $post_types = get_post_types( array( 'public' => true ) );
     94      foreach ( $post_types as $key => $post_type_name ) {
     95        $taxonomy_names = get_object_taxonomies( $post_type_name );
     96        foreach( $taxonomy_names as $taxonomy_name ) {
     97          $data .= '<option value="' . $taxonomy_name . '"' . ( ( $taxonomy_name == $value ) ? 'selected' : '' ) . '>' . $taxonomy_name . '</option>';   
     98        }
    9799      }
    98     }
    99     $data .= '</select>' . '</div>'; ?>
    100     <script>
    101     (function( $ ) {
    102       jQuery('.taxonomy_name_list select').change(function(){
    103         var taxonomyValue = {
    104           action: "get_taxonomy_term_id",
    105           postdata: jQuery('.taxonomy_name_list select').val()
    106         }
    107         jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue, function( response ) {
    108           jQuery('.parent_id_list select').empty().append(response);       
    109         } );
    110       });
    111       if ( jQuery('.taxonomy_name_list select').val() != "" ) {
    112         var taxonomyValue1 = {
    113           action: "get_taxonomy_term_id",
    114           postdata_selected: jQuery('.taxonomy_name_list select').val(),
    115           postdata_termselected: jQuery('.parent_id_list select').val()
    116         }
    117         jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue1, function( response ) {
    118           jQuery('.parent_id_list select').empty().append(response);       
    119         } );
     100      $data .= '</select>' . '</div>'; ?>
     101      <script>
     102      (function( $ ) {
     103        jQuery('.taxonomy_name_list select').change(function(){
     104          var taxonomyValue = {
     105            action: "get_taxonomy_term_id",
     106            postdata: jQuery('.taxonomy_name_list select').val()
     107          }
     108          jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue, function( response ) {
     109            jQuery('.parent_id_list select').empty().append(response);       
     110          } );
     111        });
     112        if ( jQuery('.taxonomy_name_list select').val() != "" ) {
     113          var taxonomyValue1 = {
     114            action: "get_taxonomy_term_id",
     115            postdata_selected: jQuery('.taxonomy_name_list select').val(),
     116            postdata_termselected: jQuery('.parent_id_list select').val()
     117          }
     118          jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", taxonomyValue1, function( response ) {
     119            jQuery('.parent_id_list select').empty().append(response);       
     120          } );
     121        }
     122      })( jQuery );
     123      </script>
     124      <?php return $data;
     125    }
     126   
     127    function include_child_settings_field( $settings, $value ) {
     128      $include_child_categories = '<div class="include-child"><input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('include Subcategory','taxonomy-term-listing-visual-composer-addon'). '</div>'; ?>
     129      <script>
     130      (function( $ ) {
     131        jQuery( 'input[name="include_subcategory"]' ).on( 'change', function() {
     132          this.value = this.checked ? 1 : 0 ;
     133        });
     134      })( jQuery );
     135      </script>
     136      <?php return $include_child_categories;
     137    }
     138
     139    function count_display_settings_field( $settings, $value ) {
     140      $include_count_display = '<div class="include-count"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('show count','taxonomy-term-listing-visual-composer-addon') . '</div>'; ?>
     141      <script>
     142      (function( $ ) {
     143        jQuery( 'input[name="count"]' ).on( 'change', function() {
     144          this.value = this.checked ? 1 : 0 ;
     145        });
     146      })( jQuery );
     147      </script>
     148      <?php return $include_count_display;
     149    }
     150
     151    function hide_empty_settings_field( $settings, $value ){
     152      $hide_empty_cat = '<div class="hide_empty_main"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('Hide Empty Category','taxonomy-term-listing-visual-composer-addon') . '</div>'; ?>
     153      <script>
     154      (function( $ ) {
     155        jQuery( 'input[name="hide_empty"]' ).on( 'change', function() {
     156          this.value = this.checked ? 1 : 0 ;
     157        });
     158      })( jQuery );
     159      </script>
     160      <?php return $hide_empty_cat;
     161    }
     162
     163    function specific_subcategory_settings_field( $settings, $value ) {
     164      $specific_cat = '<div class="parent_id_list">' . '<select name="'. esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
     165      $specific_cat .= '<option value="' . $value . '">'.__('Select Taxonomy first','taxonomy-term-listing-visual-composer-addon').'</option>'; 
     166      $specific_cat .= '</select>' . '</div>';
     167      return $specific_cat;
     168    }
     169
     170      // Load plugin textdomain.
     171    function taxonomy_listing_addon_load_textdomain() {
     172      load_plugin_textdomain( 'taxonomy-term-listing-visual-composer-addon', false, basename( dirname( __FILE__ ) ) . '/languages' );
     173    }
     174
     175    // frontend view
     176    function term_listing_func( $atts ) {
     177      $specific_subcategory = isset( $atts['specific_subcategory'] ) ? $atts['specific_subcategory'] : 0 ;
     178      $order_attr = ( isset( $atts['order'] ) ? $atts['order'] : 'ASC' );
     179      $taxonomy_names_attr = ( isset( $atts['taxonomy_names'] ) ? $atts['taxonomy_names'] : NULL );
     180      $class = ( isset( $atts['extra_class_name']) ? "class = ".$atts['extra_class_name'] : "");
     181      $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent'=> 0 );
     182      if ( isset( $atts['specific_subcategory'] ) || $atts['include_subcategory'] == 1 ) {
     183        if ( isset( $atts['specific_subcategory'] ) ) {
     184          $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $specific_subcategory );
     185        }
     186        $term = get_terms( $taxonomy_names_attr,$arguments );
     187        $response = '';
     188        $response = '<div class="vc_taxonomy_listing">';
     189        $response .= '<ul ' . $class . '>';
     190        foreach( $term as $terms ) {
     191          $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name.( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a>';
     192          if ( isset( $atts['specific_subcategory'] ) ? ( $terms->parent != 0 ) : ( $terms->parent == 0 ) ) {
     193            $response .= '<ul>';
     194            $arg_inner = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $terms->term_id );
     195            $child_terms = get_terms( $taxonomy_names_attr, $arg_inner );
     196            foreach( $child_terms as $child_term ) {
     197              $response .= '<li><a href="' . get_term_link( $child_term->term_id ) . '">' . $child_term->name.( $atts['count'] == 1 ? '(' . $child_term->count . ')' : '') . '</a>';
     198              if ( $child_term->parent != 0 ) {
     199                $response .= '<ul>';
     200                $arg_inner_child = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $child_term->term_id );
     201                $inner_child_terms = get_terms( $taxonomy_names_attr, $arg_inner_child );
     202                foreach( $inner_child_terms as $inner_child_term ) {
     203                  $response .= '<li><a href="' . get_term_link( $inner_child_term->term_id ) . '">' . $inner_child_term->name.( $atts['count'] == 1 ? '(' . $inner_child_term->count . ')' : '') . '</a></li>';
     204                }
     205                $response .= '</ul>';
     206              }
     207            }
     208            $response .= '</ul></li>';
     209          }
     210        }
     211        $response .= '</ul>';
     212        return $response;
     213      } else {
     214        $term = get_terms( $taxonomy_names_attr,$arguments );
     215        $response = '';
     216        $response = '<ul>';
     217        foreach ($term as $terms ){
     218          $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name . ( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a></li>';
     219        }
     220        $response .= '</ul>';
     221        $response .= '</div>';
     222        return $response;
    120223      }
    121     })( jQuery );
    122     </script>
    123     <?php return $data;
    124   }
    125  
    126   function include_child_settings_field( $settings, $value ) {
    127     $include_child_categories = '<div class="include-child"><input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('include Subcategory','taxonomy-term-list-addon'). '</div>'; ?>
    128     <script>
    129     (function( $ ) {
    130       jQuery( 'input[name="include_subcategory"]' ).on( 'change', function() {
    131         this.value = this.checked ? 1 : 0 ;
    132       });
    133     })( jQuery );
    134     </script>
    135     <?php return $include_child_categories;
    136   }
    137 
    138   function count_display_settings_field( $settings, $value ) {
    139     $include_count_display = '<div class="include-count"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('show count','taxonomy-term-list-addon') . '</div>'; ?>
    140     <script>
    141     (function( $ ) {
    142       jQuery( 'input[name="count"]' ).on( 'change', function() {
    143         this.value = this.checked ? 1 : 0 ;
    144       });
    145     })( jQuery );
    146     </script>
    147     <?php return $include_count_display;
    148   }
    149 
    150   function hide_empty_settings_field( $settings, $value ){
    151     $hide_empty_cat = '<div class="hide_empty_main"><input name="'. esc_attr( $settings['param_name'] ) .'" class="wpb_vc_param_value checkbox" type="checkbox" value="' . ( ( $value != "" ) ? $value : 1 ) . '" ' . ( $value == 1 ? checked : '' ) . '' . ( ( $value == "" ) ? checked : '' ) . ' >'.__('Hide Empty Category','taxonomy-term-list-addon') . '</div>'; ?>
    152     <script>
    153     (function( $ ) {
    154       jQuery( 'input[name="hide_empty"]' ).on( 'change', function() {
    155         this.value = this.checked ? 1 : 0 ;
    156       });
    157     })( jQuery );
    158     </script>
    159     <?php return $hide_empty_cat;
    160   }
    161 
    162   function specific_subcategory_settings_field( $settings, $value ) {
    163     $specific_cat = '<div class="parent_id_list">' . '<select name="'. esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-input wpb-select">';
    164     $specific_cat .= '<option value="' . $value . '">'.__('Select Taxonomy first','taxonomy-term-list-addon').'</option>'; 
    165     $specific_cat .= '</select>' . '</div>';
    166     return $specific_cat;
    167   }
    168 
    169     // Load plugin textdomain.
    170   function taxonomy_listing_addon_load_textdomain() {
    171     load_plugin_textdomain( 'taxonomy-term-list-addon', false, basename( dirname( __FILE__ ) ) . '/languages' );
    172   }
    173 
    174   // frontend view
    175   function term_listing_func( $atts ) {
    176     $specific_subcategory = isset( $atts['specific_subcategory'] ) ? $atts['specific_subcategory'] : 0 ;
    177     $order_attr = ( isset( $atts['order'] ) ? $atts['order'] : 'ASC' );
    178     $taxonomy_names_attr = ( isset( $atts['taxonomy_names'] ) ? $atts['taxonomy_names'] : NULL );
    179     $class = ( isset( $atts['extra_class_name']) ? "class = ".$atts['extra_class_name'] : "");
    180     $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent'=> 0 );
    181     if ( isset( $atts['specific_subcategory'] ) || $atts['include_subcategory'] == 1 ) {
    182       if ( isset( $atts['specific_subcategory'] ) ) {
    183         $arguments = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $specific_subcategory );
    184       }
    185       $term = get_terms( $taxonomy_names_attr,$arguments );
    186       $response = '';
    187       $response = '<div class="vc_taxonomy_listing">';
    188       $response .= '<ul ' . $class . '>';
    189       foreach( $term as $terms ) {
    190         $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name.( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a>';
    191         if ( isset( $atts['specific_subcategory'] ) ? ( $terms->parent != 0 ) : ( $terms->parent == 0 ) ) {
    192           $response .= '<ul>';
    193           $arg_inner = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $terms->term_id );
    194           $child_terms = get_terms( $taxonomy_names_attr, $arg_inner );
    195           foreach( $child_terms as $child_term ) {
    196             $response .= '<li><a href="' . get_term_link( $child_term->term_id ) . '">' . $child_term->name.( $atts['count'] == 1 ? '(' . $child_term->count . ')' : '') . '</a>';
    197             if ( $child_term->parent != 0 ) {
    198               $response .= '<ul>';
    199               $arg_inner_child = array( 'hide_empty' => $atts['hide_empty'], 'order' => $order_attr, 'parent' => $child_term->term_id );
    200               $inner_child_terms = get_terms( $taxonomy_names_attr, $arg_inner_child );
    201               foreach( $inner_child_terms as $inner_child_term ) {
    202                 $response .= '<li><a href="' . get_term_link( $inner_child_term->term_id ) . '">' . $inner_child_term->name.( $atts['count'] == 1 ? '(' . $inner_child_term->count . ')' : '') . '</a></li>';
    203               }
    204               $response .= '</ul>';
    205             }
    206           }
    207           $response .= '</ul></li>';
    208         }
    209       }
    210       $response .= '</ul>';
    211       return $response;
    212     } else {
    213       $term = get_terms( $taxonomy_names_attr,$arguments );
    214       $response = '';
    215       $response = '<ul>';
    216       foreach ($term as $terms ){
    217         $response .= '<li><a href="' . get_term_link( $terms->term_id ) . '">' . $terms->name . ( $atts['count'] == 1 ? '(' . $terms->count . ')' : '') . '</a></li>';
    218       }
    219       $response .= '</ul>';
    220       $response .= '</div>';
    221       return $response;
    222224    }
    223225  }
    224226}
    225 // Create obj of class.
     227// Instantiate our class
    226228$taxonomy_listing_obj = new Taxonomy_Term_Addon(); 
    227229vc_add_shortcode_param( 'Taxonomy_Names',  array($taxonomy_listing_obj, 'taxonomy_name_settings_field' ) );
Note: See TracChangeset for help on using the changeset viewer.