• Resolved woodypad

    (@woodypad)


    Hello,
    to insert some code as if it were in the functions file, do you have to insert an initial code? how do you do for the css?

    Because I moved a code that I had in the functions file into code snippet and it doesn’t work anymore.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Can you give an example of the code snippet? Most functions code should just work out of the box, but sometime there’s some adjustment necessary.

    Thread Starter woodypad

    (@woodypad)

    Hello,
    thank you for answering.
    there he is

    add_filter('the_category_list',function ($categories){
        $main_cat = v_primary_category( get_post()->ID );
        if ( $main_cat ) {
            return [get_category($main_cat)];
        }
        if ( ! empty( $categories ) ) {
            return [$categories[0]];
        }
        return $categories;
    });
    

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Initial code for functions’ is closed to new replies.