Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- .wpw-color-picker {display: block !important;}
- </style>
- <div class="wrap">
- <div id="icon-options-general" class="icon32"></div>
- <h1>Whatsapp Share Settings</h1><?php
- //we check if the page is visited by click on the tabs or on the menu button.
- //then we get the active tab.
- $active_tab = "general-options";
- if(!empty($_GET["tab"]) && $_GET["tab"] == "whatsapp-options")
- {
- $active_tab = "whatsapp-options";
- }
- ?>
- <!-- wordpress provides the styling for tabs. -->
- <h2 class="nav-tab-wrapper">
- <!-- when tab buttons are clicked we jump back to the same page but with a new parameter that represents the clicked tab. accordingly we make it active -->
- <a style="cursor:pointer;" data="general-tab-content" class="nav-tab<?php if($active_tab == 'general-options'){echo ' nav-tab-active';} ?> "><?php _e('General Settings', 'whatsapp-share-for-woocommerce'); ?></a>
- <a style="cursor:pointer;" data="whatsapp-tab-content" class="nav-tab<?php if($active_tab == 'whatsapp-options'){echo ' nav-tab-active';} ?>"><?php _e('Whatsapp Settings', 'whatsapp-share-for-woocommerce'); ?></a>
- </h2>
- <form method="post" action="" name="<?php echo self::$plugin_slug; ?>">
- <input type="hidden" name="<?php echo self::$plugin_slug; ?>" value="1"/>
- <table class="wpw_table wpwtabcontent active_content" id="general-tab-content">
- <tr>
- <td colspan="2">
- <?php
- settings_fields("general_section");
- do_settings_sections("general-options");
- ?>
- </td>
- </tr>
- <tr>
- <td width="30%">Enable Sharing?</td>
- <td>
- <input type="checkbox" name="enable" <?php echo ($this->get_setting("enable")) ? "checked=checked" : ""; ?> value="1" />
- </td>
- </tr>
- <tr>
- <td>Show in blog post/page</td>
- <td>
- <select name="enable_in_postpage">
- <option value="0" <?php echo ($this->get_setting("enable_in_postpage") == 0) ? "selected=selected" : ""; ?> >None</option>
- <option value="1" <?php echo ($this->get_setting("enable_in_postpage") == 1) ? "selected=selected" : ""; ?> >Both Posts/Pages</option>
- <option value="2" <?php echo ($this->get_setting("enable_in_postpage") == 2) ? "selected=selected" : ""; ?> >Only Posts</option>
- <option value="3" <?php echo ($this->get_setting("enable_in_postpage") == 3) ? "selected=selected" : ""; ?> >Only Pages</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Button Position for Product</td>
- <td>
- <select name="button_pos">
- <option value="0" <?php echo ($this->get_setting("button_pos") == 0) ? "selected=selected" : ""; ?>>Below Title</option>
- <option value="2" <?php echo ($this->get_setting("button_pos") == 2) ? "selected=selected" : ""; ?>>After Price</option>
- <option value="1" <?php echo ($this->get_setting("button_pos") == 1) ? "selected=selected" : ""; ?>>After Description</option>
- <option value="3" <?php echo ($this->get_setting("button_pos") == 3) ? "selected=selected" : ""; ?>>After Wishlist/Tags</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Button Position in Post/Page</td>
- <td>
- <select name="btnpost_post">
- <option value="0" <?php echo ($this->get_setting("btnpost_post") == 0) ? "selected=selected" : ""; ?>>Before Content</option>
- <option value="1" <?php echo ($this->get_setting("btnpost_post") == 1) ? "selected=selected" : ""; ?>>After Content</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Button Alignment</td>
- <td>
- <select name="alignment">
- <option value="left" <?php echo ($this->get_setting("alignment") == "left") ? "selected=selected" : ""; ?> >Left</option>
- <option value="right" <?php echo ($this->get_setting("alignment") == "right") ? "selected=selected" : ""; ?> >Right</option>
- <option value="center" <?php echo ($this->get_setting("alignment") == "center") ? "selected=selected" : ""; ?> >Center</option>
- </select>
- </td>
- </tr>
- </table>
- <table class="wpw_table wpwtabcontent " id="whatsapp-tab-content" style="display:none;">
- <tr >
- <td colspan="2">
- <?php
- settings_fields("whatsapp_section");
- do_settings_sections("whatsapp-options");
- ?>
- </td>
- </tr>
- <tr>
- <td width="30%">Enable WhatsApp Sharing?</td>
- <td>
- <input type="checkbox" name="enable_sharing" <?php echo ($this->get_setting("enable_sharing")) ? "checked=checked" : ""; ?> value="1" />
- </td>
- </tr>
- <tr>
- <td width="30%">Display Button Only on Mobile</td>
- <td>
- <input type="checkbox" name="only_mobile" <?php echo ($this->get_setting("only_mobile")) ? "checked=checked" : ""; ?> value="1" />
- <br>
- if <strong>unchecked</strong>, it will display whatsapp button on desktop (for testing on desktop).
- </td>
- </tr>
- <tr>
- <td>Share Button Text</td>
- <td>
- <input type="text" name="btntext" value="<?php echo $this->get_setting("btntext") ?>" />
- </td>
- </tr>
- <tr>
- <td>Button size</td>
- <td>
- <select name="size">
- <option value="s" <?php echo ($this->get_setting("size") == "s") ? "selected=selected" : ""; ?> >Small</option>
- <option value="m" <?php echo ($this->get_setting("size") == "m") ? "selected=selected" : ""; ?> >Medium</option>
- <option value="l" <?php echo ($this->get_setting("size") == "l") ? "selected=selected" : ""; ?> >Large</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Whatsapp Icon Color</td>
- <td>
- <select name="iconcolor">
- <option value="w" <?php echo ($this->get_setting("iconcolor") == "w") ? "selected=selected" : ""; ?> >White</option>
- <option value="b" <?php echo ($this->get_setting("iconcolor") == "b") ? "selected=selected" : ""; ?> >Black</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Transparent Button</td>
- <td>
- <select name="transparent">
- <option value="n" <?php echo ($this->get_setting("transparent") == "n") ? "selected=selected" : ""; ?> >No</option>
- <option value="y" <?php echo ($this->get_setting("transparent") == "y") ? "selected=selected" : ""; ?> >Yes</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Description Limit</td>
- <td>
- <input type="number" size="3" name="limit" value="<?php echo $this->get_setting("limit"); ?>" />
- </td>
- </tr>
- <tr>
- <td>Product Message Template</td>
- <td>
- <select name="product_message_template" id="product_message_template">
- <option value="" <?php echo ($this->get_setting("product_message_template") == "0") ? "selected=selected" : ""; ?>
- data="">--Select--</option>
- <option value="1" <?php echo ($this->get_setting("product_message_template") == "1") ? "selected=selected" : ""; ?> data="Hey,
- i Have found [product-title],
- of just [product-price] [product-saleprice]
- [product-description]">Hey,
- i Have found [product-title],
- of just [product-price] [product-saleprice]
- [product-description]</option>
- <option value="2" <?php echo ($this->get_setting("product_message_template") == "2") ? "selected=selected" : ""; ?> data="Hi Dear,
- Look at this [product-title],
- just [product-price] [product-saleprice]
- [product-description]">Hi Dear,
- Look at this [product-title],
- just [product-price] [product-saleprice]
- [product-description]</option>
- <option value="3" <?php echo ($this->get_setting("product_message_template") == "3") ? "selected=selected" : ""; ?> data="Wow,
- i found [product-title],
- of just [product-price] [product-saleprice]
- [product-description]">Wow,
- i found [product-title],
- of just [product-price] [product-saleprice]
- [product-description]</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Share Message For Product</td>
- <td>
- <textarea id="product_share_message" name="product_share_message" cols="35" rows="5"><?php echo $this->get_setting("product_share_message"); ?></textarea>
- <br>
- You can use <strong>[product-title]</strong>, <strong>[product-description]</strong> and <strong>[product-price]</strong>, <strong>[product-saleprice]</strong> <br>for display product title,description, regular price and sale price in share message.
- </td>
- </tr>
- <tr>
- <td>Template for Message For Post/Page</td>
- <td>
- <select name="postpage_share_template" id="postpage_share_template">
- <option value="" <?php echo ($this->get_setting("postpage_share_template") == "0") ? "selected=selected" : ""; ?>
- data="">--Select--</option>
- <option value="1" <?php echo ($this->get_setting("postpage_share_template") == "1") ? "selected=selected" : ""; ?> data="Hi,
- i have found [title]
- [description]">Hi,
- i have found [title]
- [description]</option>
- <option value="2" <?php echo ($this->get_setting("postpage_share_template") == "2") ? "selected=selected" : ""; ?> data="Wow,
- Amazing Post [title]
- [description]">Wow,
- Amazing Post [title]
- [description]</option>
- <option value="3" <?php echo ($this->get_setting("postpage_share_template") == "3") ? "selected=selected" : ""; ?> data="Dear,
- Look What i found, [title]
- [description]">Dear,
- Look What i found, [title]
- [description]</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Share Message For Post/Page</td>
- <td>
- <textarea name="postpage_share_message" id="postpage_share_message" cols="35" rows="5"><?php echo $this->get_setting("postpage_share_message"); ?></textarea>
- <br>
- You can use <strong>[title]</strong> and <strong>[description]</strong><br>for display post title and description in share message.
- </td>
- </tr>
- </table>
- <?php
- /*if(!empty($_GET["tab"]) && $_GET["tab"] == "whatsapp-options")
- {
- settings_fields("whatsapp_section");
- do_settings_sections("whatsapp-options");
- } else {
- settings_fields("general_section");
- do_settings_sections("general-options");
- }*/
- submit_button('Save Settings','button button-primary','wpw-submit');
- ?>
- </form>
- </div>
- <script>
- jQuery('.nav-tab-wrapper a.nav-tab').click(function(){
- jQuery('.nav-tab-wrapper a.nav-tab').removeClass('nav-tab-active');
- jQuery(this).addClass('nav-tab-active');
- jQuery('.wpw_table').hide();
- jQuery('#'+jQuery(this).attr('data')).show();
- jQuery('#product_message_template').on('change',function(){
- jQuery('#product_share_message').val(jQuery("#product_message_template option:selected").attr('data'));
- });
- jQuery('#postpage_share_template').on('change',function(){
- jQuery('#postpage_share_message').val(jQuery("#postpage_share_template option:selected").attr('data'));
- });
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement