Permalink settings must be changed from default. For the cart to display properly, your theme must contain Widget Areas. Version: 1.1 Author: 72Lux Author URI: http://72lux.com/ */ // ------------------------------------------------------------------------ // REQUIRE MINIMUM VERSION OF WORDPRESS: // ------------------------------------------------------------------------ // THIS IS USEFUL IF YOU REQUIRE A MINIMUM VERSION OF WORDPRESS TO RUN YOUR // PLUGIN. IN THIS PLUGIN THE WP_EDITOR() FUNCTION REQUIRES WORDPRESS 3.3 // OR ABOVE. ANYTHING LESS SHOWS A WARNING AND THE PLUGIN IS DEACTIVATED. // ------------------------------------------------------------------------ function shple_requires_wordpress_version () { global $wp_version; $plugin = plugin_basename( __FILE__ ); $plugin_data = get_plugin_data( __FILE__, false ); if ( version_compare($wp_version, "3.3", "<" ) ) { if( is_plugin_active($plugin) ) { deactivate_plugins( $plugin ); wp_die( "'".$plugin_data['Name']."' requires WordPress 3.3 or higher, and has been deactivated! Please upgrade WordPress and try again.

Back to WordPress admin." ); } } } add_action( 'admin_init', 'shple_requires_wordpress_version' ); // ------------------------------------------------------------------------ // PLUGIN PREFIX: // ------------------------------------------------------------------------ // 'shple_' prefix is derived from Shoppable // ------------------------------------------------------------------------ // REGISTER HOOKS & CALLBACK FUNCTIONS: // ------------------------------------------------------------------------ // Set-up Action and Filter Hooks register_activation_hook( __FILE__, 'shple_add_defaults' ); register_uninstall_hook( __FILE__, 'shple_delete_plugin_options' ); add_action( 'admin_init', 'shple_init' ); add_action( 'admin_menu', 'shple_add_settings_page' ); add_action( 'widgets_init','shple_widget_init' ); add_action('init', 'shple_shortcode_button_init'); add_action('wp_head','shple_inject_shopjs_script', 2); add_action('wp_head','shple_inject_css', 2); add_filter( 'plugin_action_links', 'shple_plugin_action_links', 10, 2 ); // -------------------------------------------------------------------------------------- // CALLBACK FUNCTION FOR: register_uninstall_hook(__FILE__, 'shple_delete_plugin_options') // -------------------------------------------------------------------------------------- // Delete options table entries ONLY when plugin deactivated AND deleted function shple_delete_plugin_options () { delete_option( 'shple_options' ); } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION FOR: register_activation_hook(__FILE__, 'shple_add_defaults') // ------------------------------------------------------------------------------ // Define default option settings function shple_add_defaults () { $tmp = get_option('shple_options'); // added the isset() because of unset array keys on activation if( isset( $tmp['chk_default_options_db'] ) && ( $tmp['chk_default_options_db']=='1' ) || ( !is_array($tmp) ) ) { delete_option('shple_options'); // so we don't have to reset all the 'off' checkboxes too! (don't think this is needed but leave for now) $arr = array( "token" => "", "flag_poweredby" => false, "chk_default_options_db" => "" ); update_option('shple_options', $arr); } } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION FOR: add_action('admin_init', 'shple_init' ) // ------------------------------------------------------------------------------ function shple_init (){ register_setting( 'shple_plugin_options', 'shple_options', 'shple_validate_options' ); } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION FOR: add_action('widgets_init' , 'shple_widget_init') // ------------------------------------------------------------------------------ function shple_widget_init (){ register_widget( 'shoppable_frame_widget' ); } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION FOR: add_action('admin_menu', 'shple_add_settings_page'); // ------------------------------------------------------------------------------ // Add menu page function shple_add_settings_page() { add_options_page( 'Shoppable Frames Configurations Page', 'Shoppable', 'manage_options', 'shoppable', 'shple_render_help_settings' ); } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION SPECIFIED IN: add_options_page() // ------------------------------------------------------------------------------ function shple_render_help_settings () { echo '

'; echo '

Shoppable Frames Settings Menu

'; $currentTab = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : 'settings'; shple_render_admin_tabs($currentTab); echo '
'; switch($currentTab) { case 'help': echo shple_render_helper_copy(); break; case 'settings': default: echo shple_render_form(); break; } echo '
'; } // render helper copy function shple_render_helper_copy () { ?>

Requirements

How can I change my Permalink settings?

Check steps #7 and #8 in our WordPress Integration Docs.

How do I place my shopping bag?

You can place the shopping bag as a widget. Navigate to your Widgets page and place the Shoppable Shopping Bag in any widget area.

My theme contains no widget areas for the shopping bag.

In these cases, a publisher will have to manually edit the theme files and include the proper Shopping Bag HTML.

Please refer to the 72Lux Documentation about Adding a Shopping Bag Link

Where can I find my Shoppable Token?

They can be located here when viewing your Shoppable Settings.

More resources

Paste your token here.
You can retrieve your API Token here
Display a PoweredBy logo. value="1" />

'.__('Settings').''; // make the 'Settings' link appear first array_unshift( $links, $shple_links ); } return $links; } // setup Help section tabs function shple_render_admin_tabs ( $current = 'settings' ) { $tabs = array( 'settings' => 'Settings', 'help' => 'Help' ); echo ''; } // ------------------------------------------------------------------------------ // Adding custom buttons to add/edit post field // ------------------------------------------------------------------------------ // init process for registering our button function shple_shortcode_button_init() { //Abort early if the user will never see TinyMCE if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') && get_user_option('rich_editing') == 'true') return; //Add a callback to regiser our tinymce plugin add_filter("mce_external_plugins", "shple_register_tinymce_plugin"); // Add a callback to add our button to the TinyMCE toolbar add_filter('mce_buttons', 'shple_add_tinymce_button'); } //This callback registers our plug-in function shple_register_tinymce_plugin($plugin_array) { # JOE: Not sure if this is the best way to do dis $plugin_array['shple_button'] = plugin_dir_url('') . '72lux-the-original-shoppable-content-and-shopping-bag/assets/js/shortcode.js'; return $plugin_array; } //This callback adds our button to the toolbar function shple_add_tinymce_button($buttons) { //Add the button ID to the $button array $buttons[] = "shple_button"; return $buttons; } // ------------------------------------------------------------------------------ // Shortcodes: // ------------------------------------------------------------------------------ function shple_shoppable_frame_shortcode($atts) { $options = get_option('shple_options'); $checked = $options['flag_poweredby'] ? ' data-show-powered-by="1" ' : 'data-show-powered-by="0"'; if (isset($atts['id'])) { return '
'; } else { return '
'; } } add_shortcode( 'shoppable_frame', 'shple_shoppable_frame_shortcode' ); // ------------------------------------------------------------------------------ // Hooks to inject proper Javascript and CSS assets: // ------------------------------------------------------------------------------ // Inject frame embed script into head for shopping bag/product frame use function shple_inject_shopjs_script () { if(!is_admin()) { $options = get_option('shple_options'); $src = plugin_dir_url('') . '72lux-the-original-shoppable-content-and-shopping-bag/assets/js/shop.min.js'; $string = ""; echo $string; } } // inject styles function shple_inject_css() { wp_enqueue_style('shoppable_styles', plugin_dir_url('') . '72lux-the-original-shoppable-content-and-shopping-bag/assets/css/shop.css'); } // ------------------------------------------------------------------------------ // Plugin Widget Class // ------------------------------------------------------------------------------ class shoppable_frame_widget extends WP_Widget{ function shoppable_frame_widget() { parent::WP_Widget(false, $name = 'Shoppable shopping bag'); } function widget($args, $instance) { $shopping_bag_title = isset( $instance['shopping_bag_title'] ) ? $instance['shopping_bag_title'] : 'SHOPPING BAG'; echo "\n"; } function update ( $new_instance, $old_instance ) { $isntance = $old_instance; $instance['shopping_bag_title'] = $new_instance['shopping_bag_title']; return $instance; } function form ( $instance ) { $shopping_bag_title = isset( $instance['shopping_bag_title'] ) ? $instance['shopping_bag_title'] : 'SHOPPING BAG'; ?>