latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Custom Pro Form & Child Theme Don't Mix

Home Forums Community Forum Custom Pro Form & Child Theme Don't Mix

This topic contains 3 replies, has 2 voices. Last updated by  Chris Winikka 3 years, 4 months ago.

Topic Author Topic
Posted: Tuesday Aug 20th, 2013 at 1:36 pm #56268

My question is this: In a customized Authorize.net checkout form, how do I get the shortcode to use the path to the child theme directory instead of the parent theme directory?

I customized an Authorize.net Checkout form according to the article (http://www.s2member.com/kb/pro-forms/#customizing-pro-forms), and no modifications were showing until I realized that it must have had something to do with the child theme (v. parent theme). I dropped my template into the parent theme, and it worked.

Of course, this defeats the purpose of a child theme, which is to keep customized PHP files safe from theme updates. I will be passing this off to my client, and I would prefer not to put my client in panic mode if he decides to update the parent theme and loses the customized form.

I’m using shortcodes for the form, so in the short code, I added

template="authnet-checkout-form.php"

How can I modify the shortcode so the template attribute looks in the child theme folder instead of the parent theme?

In answering my question, could you please be as specific as possible. For example, I’m already suspecting that it has something to do with TEMPLATEPATH v. STYLESHEETPATH, but I have no idea as to how I would make that change or even where to make the change.

Thanks.

  • This topic was modified 3 years, 4 months ago by  Chris Winikka.
  • This topic was modified 3 years, 4 months ago by  Chris Winikka.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Wednesday Aug 21st, 2013 at 8:36 am #56351
Bruce
Username: Bruce
Staff Member
@hundredvisionsguy

How can I modify the shortcode so the template attribute looks in the child theme folder instead of the parent theme?

The template attribute looks in your /wp-content/themes directory (or whatever your themes directory is set to) first if you provide it a template that way. You can move your custom template to your root theme directory, or keep it in your child theme’s directory, and instead change it to look in that directory (as in /child-theme/my-template.php).

Posted: Wednesday Aug 21st, 2013 at 10:16 am #56355

Which file contains the template attribute? And where is that file located?

Posted: Wednesday Aug 21st, 2013 at 10:30 am #56358

Never mind. I figured it out. The solution is to use relative linking, so you need to back out of the parent theme directory and then into the child theme directory. You need to add “../” to the beginning of the template path.

In the case where you have created a child theme for twenty-fourteen, you would place the modified form in “twenty-fourteen-child” and the template attribute would be

template="../twenty-fourteen-child/modified-pro-form.php"

The “../” backs it out of twenty-fourteen (the parent folder).

Thanks, Bruce.

  • This reply was modified 3 years, 4 months ago by  Chris Winikka.
Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.