Add coupon – Store list not sorted

WordPress Business Themes Forums Responsive Themes Coupon Theme Add coupon – Store list not sorted Reply To: Add coupon – Store list not sorted

WordPress Business Themes Forums Responsive Themes Coupon Theme Add coupon – Store list not sorted Reply To: Add coupon – Store list not sorted

  • Anthony
    Anthony
    Newbie 20 points

    <?php

    define(‘SIDEBAR’, true);

    define(‘HEADERSTYLES’, true);

    $CHILDTHEME = new childtheme_coupon_core;

    class childtheme_coupon_core {

    function __construct(){

    // IMAGES
    add_action(‘hook_admin_2_homeedit’, array($this, ‘_hook_admin_2_homeedit’ ) );

    // REGISTER STYLES
    add_action( ‘wp_enqueue_scripts’, array( $this, ‘register_styles’ ) );

    } // end construct

    function register_styles(){

    wp_register_style( ‘premiumpress-elementor’,FRAMREWORK_URI.’/new_css/css.elementor1.css’ );
    wp_enqueue_style( ‘premiumpress-elementor’ );

    }

    function _hook_admin_2_homeedit($c){

    $new = array(

    ‘hero’ => array(ac

    “n” => “Homepage Slider”,
    “data” => array(
    “1” => array( “t” => “Big Image 1”, “desc” => “This image is part of the slider. The recommended size is: 825×425 pixels.”, “type” => “upload”, “d” => “https://www.premiumpress.com/_demoimages/coupontheme/1.jpg” ),
    “1_link” => array( “t” => “Clickable Link”, “desc” => “This is the link users will go to when they click on the image or buttons.”, “type” => “text”, “d” => home_url().”?s=” ),

    “sep” => array(“type” => “seperator”),

    “2” => array( “t” => “Big Image 2”, “desc” => “This image is part of the slider. The recommended size is: 825×425 pixels.”, “type” => “upload”, “d” => “https://www.premiumpress.com/_demoimages/coupontheme/2.jpg” ),
    “2_link” => array( “t” => “Clickable Link”, “desc” => “This is the link users will go to when they click on the image or buttons.”, “type” => “text”, “d” => home_url().”?s=” ),

    ),
    ),

    );

    return array_merge($c,$new);
    }

    }

    ?>

    function _ascending_storelist() {
    global $post;
    // Make sure it’s the “Add Coupon” page before adding.
    if( ‘add-listing’ !== $post->post_name) { return; }
    ?>
    <script>
    var options = jQuery(‘select#reg_field_tax_store option’);
    var arr = options.map(function(_, o) { return { t: jQuery(o).text(), v: o.value }; }).get();
    arr.sort(function(o1, o2) { var t1 = o1.t.toLowerCase(), t2 = o2.t.toLowerCase(); return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0; });
    options.each(function(i, o) { o.value = arr[i].v; jQuery(o).text(arr[i].t); });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘_ascending_storelist’);

    May 30, 2019 at 1:05 am
  • Didn't find what you were after?

    Chat with us now

    or contact our support team