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.

Shortcodes in custom template

Home Forums Community Forum Shortcodes in custom template

Tagged: 

This topic contains 6 replies, has 3 voices. Last updated by  Raam Dev 4 years, 1 month ago.

Topic Author Topic
Posted: Thursday Nov 22nd, 2012 at 9:07 am #32354
eBierek
Username: eBierek

Hi,

Quick question: I need to use shortcodes for a free reg. form in a custom template. Isn’t it possible to write like this:

<?php echo do_shortcode('[s2Member-Pro-PayPal-Form register="1" level="2" ccaps="" desc="Aktivera subventionerat medlemskap" custom="domain123.se" tp="1" tt="Y" captcha="clean" /]'); ?>

I use “do_shortcode” for other parts.

Thank you in advance,
Emily

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Friday Nov 23rd, 2012 at 6:36 am #32395

Hi Emily.

Yes, you can do_shortcode like that, as long as the function is defined. Are you within WordPress?

Posted: Monday Nov 26th, 2012 at 8:55 am #32589
eBierek
Username: eBierek

Hi Cristián,

Yes, I have written this code in a template file of WordPress. And then assigned this template to a page. Like below.

<?php /* Template Name: Membership activate steeringgroup */ ?>

<?php get_header(); ?>	

<div id="content">
<?php echo do_shortcode('[s2Member-Pro-PayPal-Form register="1" level="2" ccaps="" desc="Activate subvention membership" custom="domain123.se" tp="1" tt="Y" captcha="clean" /]'); ?>
</div>
    
<?php get_sidebar(); ?>
<?php get_footer(); ?>

This is for an installation of WP, BuddyPress, bbPress and S2Member. All forms/inputs are created in S2.

When I assign this template to a page, nothing shows, or BuddyPress seems to take over and show the list of members/users.

Any advice what could be wrong? Thank you in advance,
/E

Posted: Monday Nov 26th, 2012 at 3:47 pm #32626
Raam Dev
Username: Raam
Staff Member

When I assign this template to a page, nothing shows, or BuddyPress seems to take over and show the list of members/users.

That sounds like an issue separate from s2Member. If something appears to be “overriding” a page that you’ve created, I would double-check that you’re not using a page name/permalink that’s already in use somewhere else (perhaps there’s already a special page with that name created by BuddyPress that lists users?). Maybe try creating a new page with a different name, assigning that page template, and then testing again.

Posted: Tuesday Nov 27th, 2012 at 3:20 am #32666
eBierek
Username: eBierek

Hi,

Thank you for response. Actually, I just tried that yesterday. Created a dummy page in wp-admin called “test” and assigned the template, but still the same result showing the list of members.

If I put the shortcode within the wp-editor of the same page “test” it works, but I would rather keep the code in the template so the client won’t change it accidentally.

Posted: Tuesday Nov 27th, 2012 at 10:37 am #32705
eBierek
Username: eBierek

Hi again,

It seems you are right. BuddyPress takes over, no matter what the page name/slug is. Any ideas what could be done to solve this, to show the S2-form by shortcode in a template?

In the body tag I see my template is active but somehow overwritten by BuddyPress

<body class="directory logged-in activation page page-id-246 page-child parent-pageid-244 page-template page-template-membership-activate-steering-php admin-bar debug-bar-maximized">

Would appreciate any help/tips,
Thank you in advance,
E

Posted: Tuesday Nov 27th, 2012 at 2:47 pm #32732
Raam Dev
Username: Raam
Staff Member

Hi Emily,

Unfortunately I’m not too familiar with the specifics of BuddyPress, so you’ll probably get more help asking this question on the BuddyPress.org Support Forums or the WordPress.org Support Forums.

I cannot think of any reason BuddyPress would override the template regardless of the page name or slug and the do_shortcode() line you shared in the first post looks correct and should load the s2Member Pro-Form properly.

Viewing 6 replies - 1 through 6 (of 6 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.