• dune1982

    (@dune1982)


    Hello Guys,
    hope someone can help me.
    in the file class-product-cat-list-walker.php from woocommerce there is the function:

    public function start_lvl( &$output, $depth = 0, $args = array() ) {
    		if ( 'list' != $args['style'] )
    			return;
    
    		$indent = str_repeat("\t", $depth);
    		$output .= "$indent<ul class='children'>\n";
    	}

    I would like to have a filter or action in the functions.php of my theme to change the line $output .= "$indent<ul class='children'>\n"; into $output .= "$indent<ul class='children' style='padding-left: 15px;'>\n";

    Is there a way to do this? a custom filter or action?
    thanks for help

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

    (@rossmitchell)

    Not sure if you can find a filter to catch and inject your piece of css, but why not add this to your custom css:

    ul.children {
      padding-left: 15px;
    }

    You man need some extra class prefixes.
    To be safe you need to put this into your custom css, some themes support this, there is also a plugin, otherwise convert your theme to a child theme and customise your css in the styles.css file. Details on converting to a child theme here:
    creating a child theme https://codex.www.ads-software.com/Child_Themes

    Thread Starter dune1982

    (@dune1982)

    Thank you,
    it seems like the custom css is working too. Boy my custom css file is getting long ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I add a filter for a function in the functions.php’ is closed to new replies.