WPIntell

Source evidence

Loading the plugin only on a specific page?

NM Contact Forms · support · 2015-04-28T04:58:00+00:00

mixedsentiment
highseverity
0.88relevance
5replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

7 / 36 rows with source links

19.4% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

29 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
LouDB resolved
Hello, First, thank you for the great job, the plugin is amazing! Is there a “proper” way to load it only on a specific page? I did it by adding a “if is_page” to “function front_head()” and it works. But is there a way to do it without modifying the core files? Thanks 🙂 https://wordpress.org/plugins/nm-contact-forms/ Hello, why don’t you just include the shortcode where you need the form? for e.g. you create a form, and then can include shortocde either into page content, or into you theme files, and wrap with your if statment If it needs to be only on single page, I would suggest creating a page template for that page, and then include shorcode only into that template. Or you can wrap shorcode with if statment. But this needs to be done in your theme, rather editing the plugin itself. Cause plugin allows multiple forms, and what you did, you restricted all forms to one page. if(your_statment){ echo do_shortcode('[nm_forms id="contact_me"]'); } Hope that helps, If you still need help, feel free to contact me on http://nutmedia.co.uk Thanks, Aidas Thank you so much for your prompt answer! You’re right, I hadn’t thought about the possibility of having multiple forms in the future 🙂 I realize my first message wasn’t clear: the plugin loads front.css and recaptcha.js on every page of the website even if there is no contact form on it. I tried your solution but it still loads front.css/recaptcha everywhere. It’s like: – No form at all => no front.css/recaptcha.js – One form or more => loading of front.css/recaptcha.js on the whole website even if the form itself is just on one page. I’m too much of a beginner in php to solve the mystery on my own 🙂 I see, now I get your question. Really that shouldn’t cause any trouble. As them files won’t be used anyways. Although I will see what I can do about it in next plugin update. Thanks, Aidas Hello LouDB, Please update to version 1.1.3, this version loads front end resources to page only when shortcode is used. Thanks, Aidas Brilliant! Brilliant! Brilliant! You rock 🙂 Thank you and keep up the good work!

Comments

5 shown
Aidas 2015-04-28T07:19:00+00:00

Hello, why don’t you just include the shortcode where you need the form? for e.g. you create a form, and then can include shortocde either into page content, or into you theme files, and wrap with your if statment If it needs to be only on single page, I would suggest creating a page template for that page, and then include shorcode only into that template. Or you can wrap shorcode with if statment. But this needs to be done in your theme, rather editing the plugin itself. Cause plugin allows multiple forms, and what you did, you restricted all forms to one page. if(your_statment){ echo do_shortcode('[nm_forms id="contact_me"]'); } Hope that helps, If you still need help, feel free to contact me on http://nutmedia.co.uk Thanks, Aidas

LouDB 2015-04-28T10:21:00+00:00

Thank you so much for your prompt answer! You’re right, I hadn’t thought about the possibility of having multiple forms in the future 🙂 I realize my first message wasn’t clear: the plugin loads front.css and recaptcha.js on every page of the website even if there is no contact form on it. I tried your solution but it still loads front.css/recaptcha everywhere. It’s like: – No form at all => no front.css/recaptcha.js – One form or more => loading of front.css/recaptcha.js on the whole website even if the form itself is just on one page. I’m too much of a beginner in php to solve the mystery on my own 🙂

Aidas 2015-04-28T10:43:00+00:00

I see, now I get your question. Really that shouldn’t cause any trouble. As them files won’t be used anyways. Although I will see what I can do about it in next plugin update. Thanks, Aidas

Aidas 2015-04-30T07:08:00+00:00

Hello LouDB, Please update to version 1.1.3, this version loads front end resources to page only when shortcode is used. Thanks, Aidas

LouDB 2015-04-30T15:43:00+00:00

Brilliant! Brilliant! Brilliant! You rock 🙂 Thank you and keep up the good work!