• Resolved kitka

    (@kitka)


    Hi, on this page I display a list of categories (which are countries). I use this shortcode [categories parent=”0″ orderby=category show_count=true title_li=””] which is generated by a plugin List Categories.

    My question is how to modify this shortcode so that child categories are excluded. I am guessing it is within this array?

    $atts = shortcode_atts( array( ‘child_of’ => 0, ‘current_category’ => 0, ‘depth’ => 0, ‘echo’ => 1, ‘exclude’ => ”, ‘exclude_tree’ => ”, ‘feed’ => ”, ‘feed_image’ => ”, ‘feed_type’ => ”, ‘hide_empty’ => 1, ‘hide_title_if_empty’ => false, ‘hierarchical’ => 1, ‘include’ => ”, ‘number’ => null, ‘order’ => ‘ASC’, ‘orderby’ => ‘name’, ‘pad_counts’ => 0, ‘show_count’ => 0, ‘show_option_all’ => ”, ‘show_option_none’ => __( ‘No categories’ ), ‘style’ => ‘list’, ‘taxonomy’ => ‘category’, ‘title_li’ => __( ‘Categories’ ), ‘use_desc_for_title’ => 1, ‘walker’ => null, ), $atts );

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Vishal Patel

    (@vishaliihglobal)

    Hello @kitka 

    please try to this code & shortcode

    $atts = shortcode_atts( array(
    'child_of' => 0,
    'current_category' => 0,
    'depth' => 1, // Set depth to 1 to exclude child categories
    'echo' => 1,
    'exclude' => '',
    'exclude_tree' => '',
    'feed' => '',
    'feed_image' => '',
    'feed_type' => '',
    'hide_empty' => 1,
    'hide_title_if_empty' => false,
    'hierarchical' => 1,
    'include' => '',
    'number' => null,
    'order' => 'ASC',
    'orderby' => 'name',
    'pad_counts' => 0,
    'show_count' => 0,
    'show_option_all' => '',
    'show_option_none' => ( 'No categories' ),
    'style' => 'list',
    'taxonomy' => 'category',
    'title_li' => ( 'Categories' ),
    'use_desc_for_title' => 1,
    'walker' => null,
    ), $atts );


    Shortcode here
    [categories parent="0" orderby="category" show_count="true" title_li="" depth="1"]
    Thread Starter kitka

    (@kitka)

    Thank you Vishal! Works!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.