Sunday, May 24, 2015

Wordpress woocommerce shipping payment change on postcode

function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_postcode'] = array(
   'label'     => __('Postcode', 'woocommerce'),
   'placeholder'   => _x('Postcode', 'placeholder', 'woocommerce'),
   'required'    => true,
   'clear'       => false,
   'type'        => 'select',
            'class' => array('update_totals_on_change'),
   'options'     => array(
        'E1' => __('E1', 'woocommerce' ),
        'E2' => __('E2', 'woocommerce' )
        )
 );
}
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );


Thursday, February 19, 2015

How to include redux framework in your theme functions.php



if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/redux-framework/ReduxCore/framework.php' ) ) {
    require_once( dirname( __FILE__ ) . '/redux-framework/ReduxCore/framework.php' );
}
if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/redux-framework/sample/sample-config.php' ) ) {
    require_once( dirname( __FILE__ ) . '/redux-framework/sample/sample-config.php' );
}

Hook wp_enqueue_scripts load in header and footer


function load_scripts_basic() {

    global $wp_scripts;
    wp_enqueue_style( 'style-name', get_stylesheet_uri() );
    wp_enqueue_style( 'style-bootstrap', get_template_directory_uri().'/css/bootstrap.min.css' );
    wp_enqueue_style( 'style-normalize', get_template_directory_uri().'/css/normalize.css' );
    wp_enqueue_style( 'style-awesome', get_template_directory_uri().'/css/font-awesome.min.css' );
    wp_enqueue_style( 'style-main', get_template_directory_uri().'/css/styles.css' );
    wp_enqueue_style( 'style-eng', get_template_directory_uri().'/engine1/style.css' );

    wp_enqueue_script( 'jquery-min', get_template_directory_uri() . '/js/jquery.min.js', false );
    wp_enqueue_script( 'jquery-res_collapse_menu', get_template_directory_uri() . '/js/res_collapse_menu.js', array(), '1.0.0', false );
  

    wp_enqueue_script( 'jquery-fade', get_template_directory_uri() . '/js/fade.js', array(), '1.0.0', false );
    wp_enqueue_script( 'bootstrap.newsbox', get_template_directory_uri() . '/js/jquery.bootstrap.newsbox.min.js', array(), '1.0.0', false );

    wp_register_script('html5shiv',get_bloginfo('template_url').'/js/html5shiv.js',array(),'1.0.0');
    $wp_scripts->add_data( 'html5shiv', 'conditional', 'lt IE 9' );

    wp_register_script('respond.min', get_bloginfo('template_url').'/js/respond.min.js', array(), '1.0.0' );
    $wp_scripts->add_data( 'respond.min', 'conditional', 'lt IE 9' );

// load script in footer
    wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '1.0.0', true );
    wp_enqueue_script( 'cbpAnimatedHeader', get_template_directory_uri() . '/js/cbpAnimatedHeader.js', array(), '1.0.0', true );
    wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array(), '1.0.0', true );


}
add_action( 'wp_enqueue_scripts', 'load_scripts_basic' );

Creating a meta box for posts Titan Framework



if ( !class_exists( 'TitanFramework' ) && file_exists( dirname( __FILE__ ) . '/titan/titan-framework-embedder.php' ) ) {
    require_once( dirname( __FILE__ ) . '/titan/titan-framework-embedder.php' );
}


function theme_meta_options() {
    $titan = TitanFramework::getInstance( 'pmi' );
    $myMetaBox = $titan->createMetaBox( array(
        'name' => 'Event Option',
        'post_type'  =>array('post')
    ) );

    $myMetaBox->createOption(array(
        'name'  => 'Event Start Date & Time',
        'type'  => 'date',
        'id'    => 'eventdatentime',
        'desc'  => 'Event Data & time',
        'date'  => true,
        'time'  => true
    )) ;


    $myMetaBox->createOption( array(
        'name' => 'Venue',
        'id' => 'event_venue',
        'type' => 'text',
        'desc' => 'Venue Address',

    ) );

    $myMetaBox->createOption(array(
        'name'  => 'End Date & Time',
        'type'  => 'date',
        'id'    => 'eventenddatentime',
        'desc'  => 'Event End Data & time',
        'date'  => true,
        'time'  => true
    )) ;

}

add_action( 'tf_create_options', 'theme_meta_options' );