Posted: November 3, 2017 at 3:25 pm
Hey all, I’m having some problems making the code to modify certain labels work, and I’m wondering if anyone can help with some good debugging steps/things to check. I’ve added the following code to my plugin: <blockquote cite=”<?php add_filter( ‘FHEE__EED_Promotions___add_promotions_form_inputs__ee_promotion_code_input__html_label_text’, ‘ee_registration_checkout_promotions_heading’ ); return ‘Enter your Discount Code’; However nothing seems to happen. Wondering how I would evaluate whether the code is working or not, and if there is anything I need to be aware of that has to work in my wordpress install e.g. any settings. I do also have another site specific plugin ported from an older install which used to work on an old web host, however this one doesn’t work either. I’ve tried turning them off. |
|
Hi there, The above code is working – http://take.ms/43J1Z However the label field (which that code changes) is hidden behind the input by default. Your other site likely had something like this: #ee-promotion-code-input-lbl { margin-top: -30px; } Within some custom styles so that it would display. You can add that to Appearance -> Customize -> Additional CSS Please refer to this guide for more detailed information about the CSS customizer: https://codex.wordpress.org/CSS#Custom_CSS_in_WordPress |
|
Awesome thanks Tony – I should have thought to check the one page code (doh!) Thanks though, all working now. Much appreciated. Any tips on debugging the application of the other filters? Wondering if there is anything common which stops them working? (not to worry if not, I’ll probably set them up again instead, hopefully that will work!) |
|
You’re most welcome.
Nothing should stop a hook from ‘firing’ but the priority of the code you are running will make a difference, for example, if you had 2 functions hooked into that same filter:
The text would be ‘Enter your Discount Code’ because the second function hooks in at priority 9, the first is using the default of priority 10. Take a look here: https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-hooks/ As for debugging hooks, it depends on when it’s running but you can echo something to the page, or write something to a log file to confirm if the code is running. You can also find that adding functions to your themes |
|
The support post ‘Help debugging label filter codes in site specific plugin’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.