• Resolved monique987

    (@monique987)


    Is there a way to use this plugin to remove code without replacing it….? eg. I need to remove the following code:

    $posts_number = (int) et_get_option( $shortname . ‘_woocommerce_archive_num_posts’, ‘9’ );

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

    (@bungeshea)

    It really depends on what code surrounds this line, and what you actually hope to achieve. Could you post a slightly larger snippet?

    Unfortunately, not everything can be done with Code Snippets, so there is still room for manual interventions in the source code, which (of course) become a nightmare when the modified plugin or theme gets an update.

    Personally, I follow a convention of putting short marks (@@@ in my case) in all places I have modified, so with the use of some good search/compare program I can see if my corrections are still to be re-inserted after an update. (BTW, good general guidance on plugins modifications can be found here)

    So, in your case I would just do something like

    /* @@@
    $posts_number = (int) et_get_option( $shortname .
    ‘_woocommerce_archive_num_posts’, ‘9’ );
    */

    and hope I can spot the original place again after an update…

    To be quite clear: the beauty of Code Snippets lies (among others) in the fact that they make 90% of such direct code modifications unnecessary.

    Plugin Author Shea Bunge

    (@bungeshea)

    Jarek is correct that while Code Snippets can do a lot to modify how other plugins operate, it still does require support being built into those plugins for action and filter hooks. If you are unsure about whether this support exists in the plugin you’re trying to work with, I would recommend contacting the author and asking them. If they provide you with any example code snippets, you can use this plugin to run them on your site.

    Thanks for sharing the convention you use when editing plugins @jmilewski!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use Plugin to remove code – not replace it’ is closed to new replies.