• Hi,
    I tried to create a new Test function, but when I called it. It showed error like ” Fatal error: Uncaught Error: Call to undefined function… “

    class ListCategories{
       static function list_categories($atts, $content = null) {
        $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
        );
        
        test();
        ob_start();
        wp_list_categories($atts);
        $output = ob_get_contents();
        ob_end_clean();
    
        return $output; 
      }
      
      function test(){
        //Do something
      }
    }
    add_shortcode( 'categories', array('ListCategories', 'list_categories') );
    

    Please help me for that!
    Thanks!

    • This topic was modified 5 years, 9 months ago by viettest0301.
  • The topic ‘Fatal error: Uncaught Error: Call to undefined function’ is closed to new replies.