Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter megan328

    (@megan328)

    OK – I’ll do that – thanks ?? megan

    Thread Starter megan328

    (@megan328)

    ok – this is just a little “PS”

    I figured I should show some code.
    I’m making a little plugin for myself that will allow me to show a particular set of category links on a wordpress page and I want to be able to put the category description under each link. I am basing my plugin off of “List category posts” by Fernando Briano. The code below works like I need it to except for adding the category description and I use it in the page content like: [mycatlist id=15 depth=1]

    function mycatlist_func($atts, $content=null) {
      $atts=shortcode_atts(array(
    			     'id' => '0',
    			     'name' => 'default',
    			     'depth' => '1'
    			     ), $atts);
      return my_cat_list($atts);
    }
    add_shortcode('mycatlist', 'mycatlist_func');
    
    function my_cat_list($atts){
      if($atts['name']!='default' && $atts['id']!='0'){
        $category='category_name='.$atts['name'];
      }else{
        $category='category='.$atts['id'];
      }
    $output = "<ul class='mycatlist'>";
    $output .= wp_list_categories('echo=0&title_li=&child_of='.$atts['id'].'&depth='.$atts['depth']);
    $output .= "</ul>";
      return $output;
    }

    hoping for guidance – thanks, Megan

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