Results 1 to 3 of 3

Thread: Tutorial: How to show certain codes as unhidden

  1. #1
    Thread Starter
    Expired Customer geronimo's Avatar
    Join Date
    Nov 2012
    Location
    United Kingdom
    Posts
    36
    Thanks
    2
    Thanked 6 Times in 5 Posts

    Tutorial: How to show certain codes as unhidden

    Hi,

    I thought I would share my quick and dirty method for showing certain codes as the actual code and continuing to show the rest as hidden.

    Couple of pointers:
    1. I am using Clipper 1.8.2
    2. Please test before implementing!
    3. The code is probably not be the most optimised, please feel free to share your thoughts
    4. Please test again before implementing!


    Files Needed:
    • Clipper\includes\theme-functions.php
    • Clipper\includes\admin\write-panel.php


    Step 1. Find the following code in theme-functions.php around line 1304 (sorry formatting not working)

    Code:
        switch($coupon_type) {
          case 'printable-coupon':
    ?>
    				  <h3><?php _e('Code:', 'appthemes'); ?></h3>
    					<div class="couponAndTip">
                  <div class="link-holder">
        							<a href="<?php clpr_get_coupon_image('thumb-med', 'url'); ?>" id="coupon-link-<?php echo $post->ID; ?>" class="coupon-code-link" title="<?php _e('Click to Print', 'appthemes'); ?>" target="_blank" data-rel="<?php _e('Print Coupon', 'appthemes'); ?>"><span><?php _e('Print Coupon', 'appthemes'); ?></span></a>
      						</div> <!-- #link-holder -->
      						<p class="link-popup"><span><?php _e('Click to print coupon', 'appthemes'); ?></span></p>
              </div><!-- /couponAndTip -->
    <?php
            break;
    
          case 'coupon-code':
    ?>
    					<h3><?php _e('Code:', 'appthemes'); ?></h3>
    					<div class="couponAndTip">
    							<div class="link-holder">
    								<?php if( get_option('clpr_coupon_code_hide') == 'yes' ) $button_text = __('Show Coupon Code', 'appthemes'); else $button_text = wptexturize( get_post_meta( $post->ID, 'clpr_coupon_code', true ) ); ?>
    									<a href="<?php echo clpr_get_coupon_out_url( $post ); ?>" id="coupon-link-<?php echo $post->ID; ?>" class="coupon-code-link" title="<?php _e('Click to copy &amp; open site', 'appthemes'); ?>" target="_blank" data-rel="<?php echo wptexturize( get_post_meta( $post->ID, 'clpr_coupon_code', true ) ); ?>"><span><?php echo $button_text; ?></span></a>
    							</div> <!-- #link-holder -->
    							<p class="link-popup"><span><?php _e('Click to copy &amp; open site', 'appthemes'); ?></span></p>
    					</div><!-- /couponAndTip -->
    Step 2. We're going to add a new coupon-code type in the code. I called it "normal" (you'll see why later). Do this by carefully copying the case 'coupon-code' section and pasting it again.

    Code:
        switch($coupon_type) {
          case 'printable-coupon':
    ?>
    				  <h3><?php _e('Code:', 'appthemes'); ?></h3>
    					<div class="couponAndTip">
                  <div class="link-holder">
        							<a href="<?php clpr_get_coupon_image('thumb-med', 'url'); ?>" id="coupon-link-<?php echo $post->ID; ?>" class="coupon-code-link" title="<?php _e('Click to Print', 'appthemes'); ?>" target="_blank" data-rel="<?php _e('Print Coupon', 'appthemes'); ?>"><span><?php _e('Print Coupon', 'appthemes'); ?></span></a>
      						</div> <!-- #link-holder -->
      						<p class="link-popup"><span><?php _e('Click to print coupon', 'appthemes'); ?></span></p>
              </div><!-- /couponAndTip -->
    <?php
            break;
    
          case 'normal':
    ?>
    					<h3><?php _e('Code:', 'appthemes'); ?></h3>
    					<div class="couponAndTip">
    							<div class="link-holder">
    								<?php if( get_option('clpr_coupon_code_hide') == 'yes' ) $button_text = __('Show Coupon Code', 'appthemes'); else $button_text = wptexturize( get_post_meta( $post->ID, 'clpr_coupon_code', true ) ); ?>
    									<a href="<?php echo clpr_get_coupon_out_url( $post ); ?>" id="coupon-link-<?php echo $post->ID; ?>" class="coupon-code-link" title="<?php _e('Click to copy &amp; open site', 'appthemes'); ?>" target="_blank" data-rel="<?php echo wptexturize( get_post_meta( $post->ID, 'clpr_coupon_code', true ) ); ?>"><span><?php echo $button_text; ?></span></a>
    							</div> <!-- #link-holder -->
    							<p class="link-popup"><span><?php _e('Click to copy &amp; open site', 'appthemes'); ?></span></p>
    					</div><!-- /couponAndTip -->
    <?php
            break;
    
          case 'coupon-code':
    ?>
    					<h3><?php _e('Code:', 'appthemes'); ?></h3>
    					<div class="couponAndTip">
    							<div class="link-holder">
    								<?php if( get_option('clpr_coupon_code_hide') == 'yes' ) $button_text = __('Show Coupon Code', 'appthemes'); else $button_text = wptexturize( get_post_meta( $post->ID, 'clpr_coupon_code', true ) ); ?>
    									<a href="<?php echo clpr_get_coupon_out_url( $post ); ?>" id="coupon-link-<?php echo $post->ID; ?>" class="coupon-code-link" title="<?php _e('Click to copy &amp; open site', 'appthemes'); ?>" target="_blank" data-rel="<?php echo wptexturize( get_post_meta( $post->ID, 'clpr_coupon_code', true ) ); ?>"><span><?php echo $button_text; ?></span></a>
    							</div> <!-- #link-holder -->
    							<p class="link-popup"><span><?php _e('Click to copy &amp; open site', 'appthemes'); ?></span></p>
    					</div><!-- /couponAndTip -->

    Step 3. Just to make sure you have no errors, reload your website and test clicking a coupon code, hopefully there was no error through the whole process.

    More below...

  2. #2
    Thread Starter
    Expired Customer geronimo's Avatar
    Join Date
    Nov 2012
    Location
    United Kingdom
    Posts
    36
    Thanks
    2
    Thanked 6 Times in 5 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Thread Starter
    Expired Customer geronimo's Avatar
    Join Date
    Nov 2012
    Location
    United Kingdom
    Posts
    36
    Thanks
    2
    Thanked 6 Times in 5 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Add a New Currency [Tutorial]
    By tcarter in forum Vantage General Discussion (Legacy)
    Replies: 0
    Last Post: September 24th, 2012, 02:29 PM
  2. Layout Tutorial
    By alcastrobr in forum Help Using ClassiPress
    Replies: 2
    Last Post: February 8th, 2012, 07:47 AM
  3. WP best tutorial?
    By jam786 in forum WordPress General Discussion
    Replies: 2
    Last Post: June 28th, 2011, 08:21 AM
  4. [TUTORIAL] Is there a tutorial on posting ads
    By jeffnaramor in forum ClassiPress General Discussion
    Replies: 1
    Last Post: December 24th, 2010, 08:27 AM