Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define( 'PRO_INC_CORE_FUNC' , apply_filters( 'pro_inc_core_func', true ) );
- define( 'PRO_INC_BLOG_FUNC' , apply_filters( 'pro_inc_blog_func', true ) );
- define( 'PRO_INC_GALLERY_FUNC' , apply_filters( 'pro_inc_gallery_func', true ) );
- define( 'PRO_INC_SHORTCODE_FUNC' , apply_filters( 'pro_inc_shortcode_func', true ) );
- define( 'PRO_INC_NAV_WALKER_FUNC' , apply_filters( 'pro_inc_nav_walker_func', true ) );
- define( 'PRO_INC_THEME_OPTIONS_FUNC' , apply_filters( 'pro_inc_theme_options_func', true ) );
- define( 'PRO_INC_PAGE_BUILDER_FUNC' , apply_filters( 'pro_inc_page_builder_func', true ) );
- define( 'PRO_INC_MP_FUNC' , apply_filters( 'pro_inc_mp_func', true ) );
- define( 'PRO_INC_REVSLIDER_FUNC' , apply_filters( 'pro_inc_revslider_func', true ) );
- define( 'PRO_INC_METABOXES_FUNC' , apply_filters( 'pro_inc_metaboxes_func', true ) );
- define( 'PRO_INC_MULTISITE_FUNC' , apply_filters( 'pro_inc_multisite_func', true ) );
- define( 'PRO_INC_CORE_HOOKS' , apply_filters( 'pro_inc_core_hooks', true ) );
- define( 'PRO_VISIBLE_IN_ALL_SUBSITES' , apply_filters( 'pro_visible_in_all_subsites', true ) );
- /* Include Core functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_CORE_FUNC )
- require_once(get_template_directory() . '/functions/core.php');
- /* Include Blog related Functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_BLOG_FUNC )
- require_once(get_template_directory() . '/functions/blog-functions.php');
- /* Include gallery related Functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_GALLERY_FUNC ) {
- require_once(get_template_directory() . '/functions/gallery.php');
- $satfw_gallery = new SATFW_Gallery();
- }
- /* Include shortcodes
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_SHORTCODE_FUNC )
- require_once(get_template_directory() . '/functions/shortcodes.php');
- /* Include Nav Walker Functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_NAV_WALKER_FUNC )
- require_once(get_template_directory() . '/functions/twitter_bootstrap_nav_walker.php');
- /* Include Theme Options Functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_THEME_OPTIONS_FUNC && !function_exists('m413_options') ) {
- // Admin functions
- require_once(get_template_directory() . '/admin/admin-functions.php');
- require_once(get_template_directory() . '/admin/admin-interface.php');
- require_once(get_template_directory() . '/admin/theme-settings.php');
- }
- /* Include Page Builder functions
- ------------------------------------------------------------------------------------------------------------------- */
- if( true == PRO_INC_PAGE_BUILDER_FUNC && !class_exists('AQ_Page_Builder') ) {
- //Register Aqua Page Builder
- define( 'AQPB_PATH', get_template_directory() . '/functions/aqua-page-builder/' );
- define( 'AQPB_DIR', get_template_directory_uri() . '/functions/aqua-page-builder/' );
- define( 'AQPB_TEXT_DOMAIN_SLUG' , 'pro' );
- require_once(get_template_directory() . '/functions/aqua-page-builder/aq-page-builder.php');
- require_once(get_template_directory() . '/functions/page-builder-blocks.php');
- if (class_exists( 'MarketPress' )) require_once(get_template_directory() . '/functions/page-builder-mp-blocks.php');
- require_once(get_template_directory() . '/functions/page-builder.php');
- }
- /* Include MarketPress related functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_MP_FUNC && class_exists( 'MarketPress' ) ) {
- //Register MarketPress related functions
- require_once(get_template_directory() . '/functions/mp-functions-pro.php');
- require_once(get_template_directory() . '/functions/mp-widgets-pro.php');
- // Register Multisite Functions
- if ( true == PRO_INC_MULTISITE_FUNC && is_multisite() )
- require_once(get_template_directory() . '/functions/mp-ms-functions-pro.php');
- }
- /* Include meta box functions
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_METABOXES_FUNC && !class_exists( 'cmb_Meta_Box' ) ) {
- // register metaboxes
- require_once(get_template_directory() . '/functions/metaboxes.php');
- add_filter( 'mpt_multiimage_mb_included' , '__return_true' );
- add_filter( 'cmb_meta_boxes', 'pro_theme_metaboxes' );
- }
- /* Include Rev Slider
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_REVSLIDER_FUNC ) {
- define( 'REV_SLIDER_AS_THEME' , true );
- require_once(get_template_directory() . '/functions/tgm-plugin-activation/revslider.php');
- }
- /* Add core hooks
- ------------------------------------------------------------------------------------------------------------------- */
- if ( true == PRO_INC_CORE_HOOKS ) {
- // custom comment form
- add_filter( 'comment_form_defaults' , 'pro_custom_comment_form');
- add_filter( 'comment_form_default_fields' , 'pro_custom_comment_fields');
- // custom search form
- add_filter( 'get_search_form', 'pro_search_form' );
- // register CSS & JS for PRO
- add_action('wp_enqueue_scripts', 'pro_register_style');
- add_action('wp_enqueue_scripts', 'pro_register_js');
- // Initialize the required functions to this theme
- add_action( 'init', 'pro_init_functions' , 96 );
- // call for product listing functions
- add_action('pro_product_listing_page' , 'pro_list_products' , 10 , 2);
- add_action('pro_category_page' , 'pro_list_products' , 10 , 2);
- add_action('pro_tag_page' , 'pro_list_products' , 10 , 2);
- add_action('pro_taxonomy_page' , 'pro_list_products' , 10 , 2);
- }
- /* CSS & JS
- ------------------------------------------------------------------------------------------------------------------- */
- function pro_register_style() {
- wp_enqueue_style('mp-reset-css', get_template_directory_uri() . '/css/mp-reset.css', null, null);
- wp_enqueue_style('bootstrap-css', get_template_directory_uri() . '/css/bootstrap.css', null, '3.2.3');
- wp_enqueue_style('bootstrap-responsive-css', get_template_directory_uri() . '/css/bootstrap-responsive.css', null, '3.2.3');
- wp_enqueue_style('prettyphoto-style', get_template_directory_uri() . '/css/prettyPhoto.css', null, null);
- wp_enqueue_style('css-animated-style', get_template_directory_uri() . '/css/animate.min.css', null, null);
- wp_enqueue_style('powertip-css', get_template_directory_uri() . '/css/powertip/jquery.powertip.min.css', null, null);
- wp_enqueue_style('font-awesome-3', get_template_directory_uri() . '/css/font-awesome.min.css', null, '3.2.2');
- wp_enqueue_style('pro-flexslider-css', get_template_directory_uri() . '/css/flexslider.css', null, null);
- wp_enqueue_style('pro-flexslider-custom-css', get_template_directory_uri() . '/css/flexslider-custom.css', null, null);
- wp_enqueue_style('zoome-css', get_template_directory_uri() . '/css/zoome-min.css', null, null);
- if ( class_exists('AQ_Page_Builder') )
- wp_enqueue_style('page-builder-custom-css', get_template_directory_uri() . '/css/page-builder.css', null, null);
- wp_enqueue_style('pro-css', get_template_directory_uri() . '/css/pro.css', null, '3.0.0');
- wp_enqueue_style('pro-responsive-css', get_template_directory_uri() . '/css/pro-responsive.css', null, '3.0.0');
- $selected = get_option('mpt_theme_base_style');
- switch ($selected) {
- case 'Light Blue':
- $cssfile = '/styles/color-lightblue.css';
- break;
- case 'Blue':
- $cssfile = '/styles/color-blue.css';
- break;
- case 'Red':
- $cssfile = '/styles/color-red.css';
- break;
- case 'Yellow':
- $cssfile = '/styles/color-yellow.css';
- break;
- case 'Green':
- $cssfile = '/styles/color-green.css';
- break;
- case 'Grey':
- $cssfile = '/styles/color-grey.css';
- break;
- case 'Purple':
- $cssfile = '/styles/color-purple.css';
- break;
- default:
- $cssfile = '/styles/color-lightblue.css';
- break;
- }
- wp_enqueue_style('pro-color-skin', get_template_directory_uri() . $cssfile , null, '3.0.0');
- }
- function pro_register_js(){
- wp_enqueue_script( 'comment-reply' );
- wp_enqueue_script( 'jquery-masonry' );
- wp_enqueue_script('imagesloadedjs', get_template_directory_uri() . '/js/imagesloaded.pkgd.min.js', array('jquery'));
- wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'));
- wp_enqueue_script('pro-flexslider-js', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'));
- wp_enqueue_script('filterablejs', get_template_directory_uri() . '/js/filterable.js', array('jquery'));
- wp_enqueue_script('powertip-js', get_template_directory_uri() . '/js/jquery.powertip.min.js', array('jquery'));
- wp_enqueue_script('zoome-js', get_template_directory_uri() . '/js/zoome.js', array('jquery'));
- wp_enqueue_script('prettyphotojs', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'));
- wp_enqueue_script('tinynavjs', get_template_directory_uri() . '/js/tinynav.min.js', array('jquery'));
- wp_enqueue_script('waypoints', get_template_directory_uri() . '/js/waypoints.min.js', array('jquery'));
- wp_enqueue_script('cssanimated-hover-js', get_template_directory_uri() . '/js/css-animated-hover.js', array('jquery'));
- }
- /* Init functions
- ------------------------------------------------------------------------------------------------------------------- */
- function pro_init_functions() {
- // register menu
- if(function_exists('register_nav_menus') ){
- register_nav_menus(array(
- 'mainmenu' => __('Main Menu','pro')
- )
- );
- }
- // add sidebar
- if(function_exists('register_sidebar')){
- register_sidebar(array(
- 'name' => __('Sidebar 1','pro'),
- 'id' => 'sidebar-1',
- 'description' => __('Widgets in this area will be shown in sidebar one.','pro'),
- 'before_widget' => '<div class="well sidebar-widget-well">',
- 'after_widget' => '</div><div class="clear"></div>',
- 'before_title' => '<h4 class="sidebar-widget-title">',
- 'after_title' => '</h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Sidebar 2','pro'),
- 'id' => 'sidebar-2',
- 'description' => __('Widgets in this area will be shown in sidebar two.','pro'),
- 'before_widget' => '<div class="well sidebar-widget-well">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4 class="sidebar-widget-title">',
- 'after_title' => '</h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Sidebar 3','pro'),
- 'id' => 'sidebar-3',
- 'description' => __('Widgets in this area will be shown in sidebar three.','pro'),
- 'before_widget' => '<div class="well sidebar-widget-well">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4 class="sidebar-widget-title">',
- 'after_title' => '</h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Sidebar 4','pro'),
- 'id' => 'sidebar-4',
- 'description' => __('Widgets in this area will be shown in sidebar four.','pro'),
- 'before_widget' => '<div class="well sidebar-widget-well">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4 class="sidebar-widget-title">',
- 'after_title' => '</h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Footer One','pro'),
- 'id' => 'footer-one',
- 'description' => __('First Footer Widget','pro'),
- 'before_widget' => '',
- 'after_widget' => '',
- 'before_title' => '<h4 class="page-header"><span>',
- 'after_title' => '</span></h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Footer Two','pro'),
- 'id' => 'footer-two',
- 'description' => __('Second Footer Widget','pro'),
- 'before_widget' => '',
- 'after_widget' => '',
- 'before_title' => '<h4 class="page-header"><span>',
- 'after_title' => '</span></h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Footer Three','pro'),
- 'id' => 'footer-three',
- 'description' => __('Third Footer Widget','pro'),
- 'before_widget' => '',
- 'after_widget' => '',
- 'before_title' => '<h4 class="page-header"><span>',
- 'after_title' => '</span></h4>'
- )
- );
- register_sidebar(array(
- 'name' => __('Footer Four','pro'),
- 'id' => 'footer-fourth',
- 'description' => __('Fourth Footer Widget','pro'),
- 'before_widget' => '',
- 'after_widget' => '',
- 'before_title' => '<h4 class="page-header"><span>',
- 'after_title' => '</span></h4>'
- )
- );
- }
- // add post type support to page and post
- add_post_type_support( 'page', 'excerpt' );
- add_post_type_support( 'page', 'thumbnail' );
- add_post_type_support( 'post', 'excerpt');
- add_post_type_support( 'post', 'custom-fields');
- add_post_type_support( 'post', 'comments');
- if ( class_exists( 'MarketPress' ) ) {
- add_post_type_support( 'product', 'comments' );
- }
- // add thumbnail support to theme
- if ( function_exists( 'add_theme_support' ) ) {
- add_theme_support( 'post-thumbnails' );
- }
- // add additional image size
- if ( function_exists( 'add_image_size' ) ) {
- add_image_size( 'tb-360', 360, 270 );
- add_image_size( 'tb-860', 860, 300 );
- add_image_size( 'tb-600' , 600 , 450 , true ); // 4x3 ratio
- add_image_size( 'tb-600-masonry' , 600 , 9999 , true ); // unlimited height
- add_image_size( 'tb-full-width', 1200 , 9999 ); // full width image
- }
- if ( ! class_exists( 'cmb_Meta_Box' ) )
- require_once(get_template_directory() . '/functions/metabox/init.php');
- // add product default image
- add_filter( 'mp_default_product_img' , 'pro_default_product_img' );
- }
- /* Product Listing action hooks
- ------------------------------------------------------------------------------------------------------------------- */
- function pro_list_products( $unique_id = '' , $context = '' ) {
- $btnclass = mpt_load_mp_btn_color();
- $iconclass = mpt_load_whiteicon_in_btn();
- $labelcolor = mpt_load_mp_label_color();
- $span = mpt_load_product_listing_layout();
- $counter = mpt_load_product_listing_counter();
- $entries = get_option('mpt_mp_listing_entries');
- $advancedsoft = mpt_enable_advanced_sort();
- $advancedsoftbtnposition = mpt_advanced_sort_btn_position();
- $args = array(
- 'unique_id' => $unique_id,
- 'sort' => $advancedsoft,
- 'align' => $advancedsoftbtnposition,
- 'context' => $context,
- 'echo' => false,
- 'paginate' => true,
- 'per_page' => $entries,
- 'category' => ( $context == 'category' ? $unique_id : '' ),
- 'tag' => ( $context == 'tag' ? $unique_id : '' ),
- 'counter' => $counter,
- 'span' => $span,
- 'btnclass' => $btnclass,
- 'iconclass' => $iconclass,
- 'labelcolor' => $labelcolor
- );
- echo apply_filters( 'func_pro_list_products' , pro_advance_product_sort( $args ) , $args );
- }
- /* Comment Form functions
- ------------------------------------------------------------------------------------------------------------------- */
- function pro_custom_comment_form($defaults) {
- $defaults['comment_notes_before'] = '';
- $defaults['id_form'] = 'pro-comment-form';
- $defaults['comment_field'] = '<textarea name="comment" id="comment" class="span12" rows="10" placeholder="'.__( 'Leave Your Comments Here' , 'pro' ).'"></textarea>';
- $defaults['comment_notes_after'] = '<div class="form-allowed-tags alert alert-info"><strong>'.__( 'Head up!' , 'pro' ).'</strong> ' . __( 'You may use these HTML tags and attributes: ' , 'pro' ) . ' <code>' . allowed_tags() . '</code>' . '</div>';
- return $defaults;
- }
- function pro_custom_comment_fields() {
- $commenter = wp_get_current_commenter();
- $req = get_option('require_name_email');
- $aria_req = ( $req ? ' aria-required="true"' : '' );
- $fields = array(
- 'author' => '<div class="row-fluid"><input type="text" id="author" name="author" value="'.esc_attr($commenter['comment_author']).'"'.$aria_req.' class="span6" placeholder="'.__( 'Your Name' , 'pro' ).( $req ? ' ' . __( '(required)' , 'pro' ) : '' ).'" />',
- 'email' => '<input type="text" id="email" name="email" value="'.esc_attr($commenter['comment_author_email']).'"'.$aria_req.' class="span6" placeholder="'.__( 'Your Email' , 'pro' ). ' (' .( $req ? __( 'required' , 'pro' ) : '' ).' - '.__( 'will not be published' , 'pro' ).')" /></div>',
- 'url' => '<input type="text" id="url" name="url" value="'.esc_attr($commenter['comment_author_url']).'" class="span12" placeholder="'.__( 'Your Website URL (optional)' , 'pro' ).'" />',
- );
- return $fields;
- }
- // list Comments callback function
- function pro_list_comments( $comment , $args , $depth ) {
- $GLOBALS['comment'] = $comment;
- ?>
- <?php if ( get_comment_type() == 'pingback' || get_comment_type() == 'trackback') : ?>
- <li id="comment-<?php comment_ID(); ?>">
- <div <?php comment_class('well well-small well-comment'); ?>>
- <h4><?php _e( 'Pingback: ' , 'pro' ); ?></h4>
- <div class="comment-pingback">
- <?php echo apply_filters( 'pro_comment_pingback' , get_comment_author_link($comment->comment_ID) ); ?>
- </div>
- <?php edit_comment_link(); ?>
- </div><!-- End well-comment-->
- <?php elseif ( get_comment_type() == 'comment' ) : ?>
- <li id="comment-<?php comment_ID(); ?>">
- <div <?php comment_class('well well-small well-comment'); ?>>
- <div class="comment-author">
- <div class="comment-author-avatar">
- <?php
- $avatar_size = 48;
- if ( $comment->comment_parent != 0 ) {
- $avatar_size = 40;
- }
- echo get_avatar($comment , $avatar_size);
- ?>
- <span class="comment-author-name"><?php comment_author_link(); ?></span>
- </div>
- </div>
- <div class="clear"></div>
- <div class="comment-time"><?php comment_date(); ?> - <?php comment_time(); ?><?php edit_comment_link( __( 'edit' , 'pro' ) , ' ( ' , ' )' );?></div>
- <?php if ($comment->comment_approved == '0') : ?>
- <div class="comment-awaiting-approval">
- <?php echo apply_filters( 'pro_comment_awaiting_approval' , __( 'Your comment is awaiting moderation' , 'pro' ) ); ?>
- </div>
- <?php else : ?>
- <div class="comment-contents">
- <?php echo wpautop(get_comment_text($comment->comment_ID)); ?>
- </div>
- <?php endif; ?>
- <div class="comment-reply-button">
- <?php comment_reply_link(array_merge( $args , array( 'depth' => $depth , 'max_depth' => $args['max_depth'] ) ) ); ?>
- </div><!-- End comment-reply-button -->
- </div><!-- End well-comment-->
- <?php endif;
- }
- /* Search Form function
- ------------------------------------------------------------------------------------------------------------------- */
- function pro_search_form( $form ) {
- $form = '<form role="search" class="form-search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
- <label class="screen-reader-text" for="s">' . __( 'Search for:' , 'pro' ) . '</label>
- <div class="input-append">
- <input type="text" value="' . get_search_query() . '" class="input-medium" name="s" id="s" />
- <button type="submit" id="searchsubmit" class="btn">'. __( 'Search' , 'pro' ) .'</button>" />
- </div>
- </form>';
- return $form;
- }
- /* Default Product Image Filter
- ------------------------------------------------------------------------------------------------------------------- */
- function pro_default_product_img( $image = '' ) {
- $default_img_url = esc_url( get_option('mpt_mp_default_product_img') );
- if ( !empty($default_img_url) )
- return $default_img_url;
- else
- return $image;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement