• Resolved Anandabrata Ghosh

    (@ananddevops)


    Hello,

    I am using the WCMP plugin along with Woocommerce plugin on this theme. I want to block of a dashboard menu section – Knowledgebase.

    I have got the code snippet and filter value from WCMP – Code Snippet to Add Filter

    I have learnt that I need to add this code anywhere(I am adding to the bottom)
    of storefront_functions.php.

    Till here is my understanding correct? Else kindly guide me.

    After making the code changes will it reflect automatically on the live site, or do I need to restart the server?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    Hi @ananddevops. First of all, adding custom PHP is something you normally can get help for from the developer who shared the custom snippet.

    That said, I’d highly discourage using the Storefront functions.php file, because every time Storefront has an update, it means that your code will be disabled.

    The best approach is to use a child theme. Here are the instructions on how to use that: https://docs.woocommerce.com/document/set-up-and-use-a-child-theme/

    Thread Starter Anandabrata Ghosh

    (@ananddevops)

    @jobthomas

    Thank you for the revert.

    1. Ok. Not seeking a confirmation on the PHP code. But could you clarify incase I want to make filter/hook changes to functions.php, incase of storefront theme, is that file storefront_functions.php?
    2. Adding the code anywhere in the file will work? Querying specific to storefront theme?
    3. I understand and child theme is a must and thats what I will eventually do. As of now I need to run a basic test(like a hello world) and see if all goes all well before I undergo the child theme exercise.
    4.To my last query, will the changes reflect on save, or do I need to republish the page/restart the hosting instance/any other draft to publish change method? Again confirming specific to Storefront theme.

    Thanks

    Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    1. Ok. Not seeking a confirmation on the PHP code. But could you clarify incase I want to make filter/hook changes to functions.php, incase of storefront theme, is that file storefront_functions.php?

    Nope. The file needs to be functions.php in your child theme folder (or in Storefront).

    2. Adding the code anywhere in the file will work? Querying specific to storefront theme?

    Yup. It’ll work from top to bottom and get priority over WC core functions. (So the lower on that file the more likely it’ll display.)

    3. I understand and child theme is a must and thats what I will eventually do. As of now I need to run a basic test(like a hello world) and see if all goes all well before I undergo the child theme exercise.

    A child theme takes less than 10 minutes to configure (you can even find plugins to do it for you), so I won’t wait wit that.

    4.To my last query, will the changes reflect on save, or do I need to republish the page/restart the hosting instance/any other draft to publish change method? Again confirming specific to Storefront theme.

    As soon as you save the file and it’s in the right place, the new code will be active. There’s no such thing as a draft here.

    Thread Starter Anandabrata Ghosh

    (@ananddevops)

    @jobthomas

    That helped.
    Appreciate the help.

    Thanks

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

The topic ‘Adding Filters for WCMP plugin Guidance’ is closed to new replies.