Steven Ferrino

Technical SEO / PHP Developer

  • Home
  • SEO
  • Local Search
  • PHP
You are here: Home / PHP / WishList Member do_shortcode

WishList Member do_shortcode

January 13, 2012 by Steven Leave a Comment

I love the functionality of WishList Membership, but there are some limitations, a big one being that it wasn’t written for people to modify and adapt t existing templates easily.

In a recent installation we wanted to allow people to view video 1 of a 7 video  series, and when they click on any of the other videos shown on the page we wanted to have a pop-up with the WishList Member Registration form.

Sounds Simple!

Sounds is about it, actually doing it took a little integration of everything involved: WordPress, WishList, & JQuery.

The first hurdle was getting the WishList Registration form to show up on a page dynamically without having the [ register_level ] in the content. WordPress offers do_shortcode($args); but it doesn’t work in this instance, and exporting all the shortcodes does not reveal the WishList shortcode.

In WordPress you can see all working shortcodes using:

print_r($shortcode_tags); 

I did this little hack to insert the shortcode inside of a div tag on the page.


function sf_addRegister($content) {
return $content . "<div id='registerHolder' style='display:none'>[register_Silver]</div>";
}

$post->post_content = sf_addRegister($post->post_content);

Next we have to take the form from the div and put it where we want. I did this with jQuery, but you can do it in whatever method you are comfortable with:


jQuery(document).ready(function() {

var registrationHTML = jQuery("#registerHolder").html();

jQuery("#registrationContainer").html( registrationHTML );
jQuery("#registerHolder").html( "" );
});

NOTE: I cleaned out the original registerHolder to make sure there was no conflicts.

From here it is just a matter of controlling the pop-up and other actions you plan to perform.

 

 

Filed Under: PHP, Wordpress

Steven Ferrino

Recent Posts

  • Google Core March 2023 Not Just E-A-T
  • [Fix] – Jupiter Theme: /jupiter/dynamic-styles/global/header.php on line 346
  • Laravel 5.4: SQLSTATE[42000]: Password_resets – [Solution]
  • Restrict wp-login.php Access With Htaccess
  • Reading CSV Data and Ignoring NA’s

Blogroll

  • Microdata Generator

Profiles

  • LinkedIn
  • Twitter

Copyright © 2023 · Dynamik-Gen on Genesis Framework · WordPress · Log in