Advertisement
Guest User

Untitled

a guest
Dec 9th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.03 KB | None | 0 0
  1. <?php
  2.  
  3. define( 'PRO_INC_CORE_FUNC' , apply_filters( 'pro_inc_core_func', true ) );
  4. define( 'PRO_INC_BLOG_FUNC' , apply_filters( 'pro_inc_blog_func', true ) );
  5. define( 'PRO_INC_GALLERY_FUNC' , apply_filters( 'pro_inc_gallery_func', true ) );
  6. define( 'PRO_INC_SHORTCODE_FUNC' , apply_filters( 'pro_inc_shortcode_func', true ) );
  7. define( 'PRO_INC_NAV_WALKER_FUNC' , apply_filters( 'pro_inc_nav_walker_func', true ) );
  8. define( 'PRO_INC_THEME_OPTIONS_FUNC' , apply_filters( 'pro_inc_theme_options_func', true ) );
  9. define( 'PRO_INC_PAGE_BUILDER_FUNC' , apply_filters( 'pro_inc_page_builder_func', true ) );
  10. define( 'PRO_INC_MP_FUNC' , apply_filters( 'pro_inc_mp_func', true ) );
  11. define( 'PRO_INC_REVSLIDER_FUNC' , apply_filters( 'pro_inc_revslider_func', true ) );
  12. define( 'PRO_INC_METABOXES_FUNC' , apply_filters( 'pro_inc_metaboxes_func', true ) );
  13. define( 'PRO_INC_MULTISITE_FUNC' , apply_filters( 'pro_inc_multisite_func', true ) );
  14. define( 'PRO_INC_CORE_HOOKS' , apply_filters( 'pro_inc_core_hooks', true ) );
  15. define( 'PRO_VISIBLE_IN_ALL_SUBSITES' , apply_filters( 'pro_visible_in_all_subsites', true ) );
  16.  
  17. /* Include Core functions
  18. ------------------------------------------------------------------------------------------------------------------- */
  19.  
  20. if ( true == PRO_INC_CORE_FUNC )
  21. require_once(get_template_directory() . '/functions/core.php');
  22.  
  23. /* Include Blog related Functions
  24. ------------------------------------------------------------------------------------------------------------------- */
  25.  
  26. if ( true == PRO_INC_BLOG_FUNC )
  27. require_once(get_template_directory() . '/functions/blog-functions.php');
  28.  
  29. /* Include gallery related Functions
  30. ------------------------------------------------------------------------------------------------------------------- */
  31.  
  32. if ( true == PRO_INC_GALLERY_FUNC ) {
  33. require_once(get_template_directory() . '/functions/gallery.php');
  34. $satfw_gallery = new SATFW_Gallery();
  35. }
  36.  
  37. /* Include shortcodes
  38. ------------------------------------------------------------------------------------------------------------------- */
  39.  
  40. if ( true == PRO_INC_SHORTCODE_FUNC )
  41. require_once(get_template_directory() . '/functions/shortcodes.php');
  42.  
  43. /* Include Nav Walker Functions
  44. ------------------------------------------------------------------------------------------------------------------- */
  45.  
  46. if ( true == PRO_INC_NAV_WALKER_FUNC )
  47. require_once(get_template_directory() . '/functions/twitter_bootstrap_nav_walker.php');
  48.  
  49. /* Include Theme Options Functions
  50. ------------------------------------------------------------------------------------------------------------------- */
  51.  
  52. if ( true == PRO_INC_THEME_OPTIONS_FUNC && !function_exists('m413_options') ) {
  53. // Admin functions
  54. require_once(get_template_directory() . '/admin/admin-functions.php');
  55. require_once(get_template_directory() . '/admin/admin-interface.php');
  56. require_once(get_template_directory() . '/admin/theme-settings.php');
  57. }
  58.  
  59. /* Include Page Builder functions
  60. ------------------------------------------------------------------------------------------------------------------- */
  61.  
  62. if( true == PRO_INC_PAGE_BUILDER_FUNC && !class_exists('AQ_Page_Builder') ) {
  63. //Register Aqua Page Builder
  64. define( 'AQPB_PATH', get_template_directory() . '/functions/aqua-page-builder/' );
  65. define( 'AQPB_DIR', get_template_directory_uri() . '/functions/aqua-page-builder/' );
  66. define( 'AQPB_TEXT_DOMAIN_SLUG' , 'pro' );
  67. require_once(get_template_directory() . '/functions/aqua-page-builder/aq-page-builder.php');
  68. require_once(get_template_directory() . '/functions/page-builder-blocks.php');
  69. if (class_exists( 'MarketPress' )) require_once(get_template_directory() . '/functions/page-builder-mp-blocks.php');
  70. require_once(get_template_directory() . '/functions/page-builder.php');
  71. }
  72.  
  73. /* Include MarketPress related functions
  74. ------------------------------------------------------------------------------------------------------------------- */
  75.  
  76. if ( true == PRO_INC_MP_FUNC && class_exists( 'MarketPress' ) ) {
  77. //Register MarketPress related functions
  78. require_once(get_template_directory() . '/functions/mp-functions-pro.php');
  79. require_once(get_template_directory() . '/functions/mp-widgets-pro.php');
  80.  
  81. // Register Multisite Functions
  82. if ( true == PRO_INC_MULTISITE_FUNC && is_multisite() )
  83. require_once(get_template_directory() . '/functions/mp-ms-functions-pro.php');
  84. }
  85.  
  86. /* Include meta box functions
  87. ------------------------------------------------------------------------------------------------------------------- */
  88.  
  89. if ( true == PRO_INC_METABOXES_FUNC && !class_exists( 'cmb_Meta_Box' ) ) {
  90. // register metaboxes
  91. require_once(get_template_directory() . '/functions/metaboxes.php');
  92.  
  93. add_filter( 'mpt_multiimage_mb_included' , '__return_true' );
  94. add_filter( 'cmb_meta_boxes', 'pro_theme_metaboxes' );
  95. }
  96.  
  97. /* Include Rev Slider
  98. ------------------------------------------------------------------------------------------------------------------- */
  99.  
  100. if ( true == PRO_INC_REVSLIDER_FUNC ) {
  101. define( 'REV_SLIDER_AS_THEME' , true );
  102. require_once(get_template_directory() . '/functions/tgm-plugin-activation/revslider.php');
  103. }
  104.  
  105. /* Add core hooks
  106. ------------------------------------------------------------------------------------------------------------------- */
  107.  
  108. if ( true == PRO_INC_CORE_HOOKS ) {
  109.  
  110. // custom comment form
  111. add_filter( 'comment_form_defaults' , 'pro_custom_comment_form');
  112. add_filter( 'comment_form_default_fields' , 'pro_custom_comment_fields');
  113.  
  114. // custom search form
  115. add_filter( 'get_search_form', 'pro_search_form' );
  116.  
  117. // register CSS & JS for PRO
  118. add_action('wp_enqueue_scripts', 'pro_register_style');
  119. add_action('wp_enqueue_scripts', 'pro_register_js');
  120.  
  121. // Initialize the required functions to this theme
  122. add_action( 'init', 'pro_init_functions' , 96 );
  123.  
  124. // call for product listing functions
  125. add_action('pro_product_listing_page' , 'pro_list_products' , 10 , 2);
  126. add_action('pro_category_page' , 'pro_list_products' , 10 , 2);
  127. add_action('pro_tag_page' , 'pro_list_products' , 10 , 2);
  128. add_action('pro_taxonomy_page' , 'pro_list_products' , 10 , 2);
  129.  
  130. }
  131.  
  132. /* CSS & JS
  133. ------------------------------------------------------------------------------------------------------------------- */
  134.  
  135. function pro_register_style() {
  136. wp_enqueue_style('mp-reset-css', get_template_directory_uri() . '/css/mp-reset.css', null, null);
  137. wp_enqueue_style('bootstrap-css', get_template_directory_uri() . '/css/bootstrap.css', null, '3.2.3');
  138. wp_enqueue_style('bootstrap-responsive-css', get_template_directory_uri() . '/css/bootstrap-responsive.css', null, '3.2.3');
  139. wp_enqueue_style('prettyphoto-style', get_template_directory_uri() . '/css/prettyPhoto.css', null, null);
  140. wp_enqueue_style('css-animated-style', get_template_directory_uri() . '/css/animate.min.css', null, null);
  141. wp_enqueue_style('powertip-css', get_template_directory_uri() . '/css/powertip/jquery.powertip.min.css', null, null);
  142. wp_enqueue_style('font-awesome-3', get_template_directory_uri() . '/css/font-awesome.min.css', null, '3.2.2');
  143. wp_enqueue_style('pro-flexslider-css', get_template_directory_uri() . '/css/flexslider.css', null, null);
  144. wp_enqueue_style('pro-flexslider-custom-css', get_template_directory_uri() . '/css/flexslider-custom.css', null, null);
  145. wp_enqueue_style('zoome-css', get_template_directory_uri() . '/css/zoome-min.css', null, null);
  146. if ( class_exists('AQ_Page_Builder') )
  147. wp_enqueue_style('page-builder-custom-css', get_template_directory_uri() . '/css/page-builder.css', null, null);
  148. wp_enqueue_style('pro-css', get_template_directory_uri() . '/css/pro.css', null, '3.0.0');
  149. wp_enqueue_style('pro-responsive-css', get_template_directory_uri() . '/css/pro-responsive.css', null, '3.0.0');
  150.  
  151. $selected = get_option('mpt_theme_base_style');
  152. switch ($selected) {
  153. case 'Light Blue':
  154. $cssfile = '/styles/color-lightblue.css';
  155. break;
  156. case 'Blue':
  157. $cssfile = '/styles/color-blue.css';
  158. break;
  159. case 'Red':
  160. $cssfile = '/styles/color-red.css';
  161. break;
  162. case 'Yellow':
  163. $cssfile = '/styles/color-yellow.css';
  164. break;
  165. case 'Green':
  166. $cssfile = '/styles/color-green.css';
  167. break;
  168. case 'Grey':
  169. $cssfile = '/styles/color-grey.css';
  170. break;
  171. case 'Purple':
  172. $cssfile = '/styles/color-purple.css';
  173. break;
  174. default:
  175. $cssfile = '/styles/color-lightblue.css';
  176. break;
  177. }
  178. wp_enqueue_style('pro-color-skin', get_template_directory_uri() . $cssfile , null, '3.0.0');
  179. }
  180.  
  181. function pro_register_js(){
  182. wp_enqueue_script( 'comment-reply' );
  183. wp_enqueue_script( 'jquery-masonry' );
  184. wp_enqueue_script('imagesloadedjs', get_template_directory_uri() . '/js/imagesloaded.pkgd.min.js', array('jquery'));
  185. wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'));
  186. wp_enqueue_script('pro-flexslider-js', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'));
  187. wp_enqueue_script('filterablejs', get_template_directory_uri() . '/js/filterable.js', array('jquery'));
  188. wp_enqueue_script('powertip-js', get_template_directory_uri() . '/js/jquery.powertip.min.js', array('jquery'));
  189. wp_enqueue_script('zoome-js', get_template_directory_uri() . '/js/zoome.js', array('jquery'));
  190. wp_enqueue_script('prettyphotojs', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'));
  191. wp_enqueue_script('tinynavjs', get_template_directory_uri() . '/js/tinynav.min.js', array('jquery'));
  192. wp_enqueue_script('waypoints', get_template_directory_uri() . '/js/waypoints.min.js', array('jquery'));
  193. wp_enqueue_script('cssanimated-hover-js', get_template_directory_uri() . '/js/css-animated-hover.js', array('jquery'));
  194. }
  195.  
  196. /* Init functions
  197. ------------------------------------------------------------------------------------------------------------------- */
  198.  
  199. function pro_init_functions() {
  200.  
  201. // register menu
  202. if(function_exists('register_nav_menus') ){
  203. register_nav_menus(array(
  204. 'mainmenu' => __('Main Menu','pro')
  205. )
  206. );
  207. }
  208.  
  209. // add sidebar
  210. if(function_exists('register_sidebar')){
  211. register_sidebar(array(
  212. 'name' => __('Sidebar 1','pro'),
  213. 'id' => 'sidebar-1',
  214. 'description' => __('Widgets in this area will be shown in sidebar one.','pro'),
  215. 'before_widget' => '<div class="well sidebar-widget-well">',
  216. 'after_widget' => '</div><div class="clear"></div>',
  217. 'before_title' => '<h4 class="sidebar-widget-title">',
  218. 'after_title' => '</h4>'
  219. )
  220. );
  221.  
  222. register_sidebar(array(
  223. 'name' => __('Sidebar 2','pro'),
  224. 'id' => 'sidebar-2',
  225. 'description' => __('Widgets in this area will be shown in sidebar two.','pro'),
  226. 'before_widget' => '<div class="well sidebar-widget-well">',
  227. 'after_widget' => '</div>',
  228. 'before_title' => '<h4 class="sidebar-widget-title">',
  229. 'after_title' => '</h4>'
  230. )
  231. );
  232.  
  233. register_sidebar(array(
  234. 'name' => __('Sidebar 3','pro'),
  235. 'id' => 'sidebar-3',
  236. 'description' => __('Widgets in this area will be shown in sidebar three.','pro'),
  237. 'before_widget' => '<div class="well sidebar-widget-well">',
  238. 'after_widget' => '</div>',
  239. 'before_title' => '<h4 class="sidebar-widget-title">',
  240. 'after_title' => '</h4>'
  241. )
  242. );
  243.  
  244. register_sidebar(array(
  245. 'name' => __('Sidebar 4','pro'),
  246. 'id' => 'sidebar-4',
  247. 'description' => __('Widgets in this area will be shown in sidebar four.','pro'),
  248. 'before_widget' => '<div class="well sidebar-widget-well">',
  249. 'after_widget' => '</div>',
  250. 'before_title' => '<h4 class="sidebar-widget-title">',
  251. 'after_title' => '</h4>'
  252. )
  253. );
  254.  
  255. register_sidebar(array(
  256. 'name' => __('Footer One','pro'),
  257. 'id' => 'footer-one',
  258. 'description' => __('First Footer Widget','pro'),
  259. 'before_widget' => '',
  260. 'after_widget' => '',
  261. 'before_title' => '<h4 class="page-header"><span>',
  262. 'after_title' => '</span></h4>'
  263. )
  264. );
  265. register_sidebar(array(
  266. 'name' => __('Footer Two','pro'),
  267. 'id' => 'footer-two',
  268. 'description' => __('Second Footer Widget','pro'),
  269. 'before_widget' => '',
  270. 'after_widget' => '',
  271. 'before_title' => '<h4 class="page-header"><span>',
  272. 'after_title' => '</span></h4>'
  273. )
  274. );
  275. register_sidebar(array(
  276. 'name' => __('Footer Three','pro'),
  277. 'id' => 'footer-three',
  278. 'description' => __('Third Footer Widget','pro'),
  279. 'before_widget' => '',
  280. 'after_widget' => '',
  281. 'before_title' => '<h4 class="page-header"><span>',
  282. 'after_title' => '</span></h4>'
  283. )
  284. );
  285.  
  286. register_sidebar(array(
  287. 'name' => __('Footer Four','pro'),
  288. 'id' => 'footer-fourth',
  289. 'description' => __('Fourth Footer Widget','pro'),
  290. 'before_widget' => '',
  291. 'after_widget' => '',
  292. 'before_title' => '<h4 class="page-header"><span>',
  293. 'after_title' => '</span></h4>'
  294. )
  295. );
  296. }
  297.  
  298. // add post type support to page and post
  299. add_post_type_support( 'page', 'excerpt' );
  300. add_post_type_support( 'page', 'thumbnail' );
  301. add_post_type_support( 'post', 'excerpt');
  302. add_post_type_support( 'post', 'custom-fields');
  303. add_post_type_support( 'post', 'comments');
  304.  
  305. if ( class_exists( 'MarketPress' ) ) {
  306. add_post_type_support( 'product', 'comments' );
  307. }
  308.  
  309. // add thumbnail support to theme
  310. if ( function_exists( 'add_theme_support' ) ) {
  311. add_theme_support( 'post-thumbnails' );
  312. }
  313.  
  314. // add additional image size
  315. if ( function_exists( 'add_image_size' ) ) {
  316. add_image_size( 'tb-360', 360, 270 );
  317. add_image_size( 'tb-860', 860, 300 );
  318. add_image_size( 'tb-600' , 600 , 450 , true ); // 4x3 ratio
  319. add_image_size( 'tb-600-masonry' , 600 , 9999 , true ); // unlimited height
  320. add_image_size( 'tb-full-width', 1200 , 9999 ); // full width image
  321. }
  322.  
  323. if ( ! class_exists( 'cmb_Meta_Box' ) )
  324. require_once(get_template_directory() . '/functions/metabox/init.php');
  325.  
  326. // add product default image
  327. add_filter( 'mp_default_product_img' , 'pro_default_product_img' );
  328. }
  329.  
  330. /* Product Listing action hooks
  331. ------------------------------------------------------------------------------------------------------------------- */
  332.  
  333. function pro_list_products( $unique_id = '' , $context = '' ) {
  334.  
  335. $btnclass = mpt_load_mp_btn_color();
  336. $iconclass = mpt_load_whiteicon_in_btn();
  337. $labelcolor = mpt_load_mp_label_color();
  338. $span = mpt_load_product_listing_layout();
  339. $counter = mpt_load_product_listing_counter();
  340. $entries = get_option('mpt_mp_listing_entries');
  341. $advancedsoft = mpt_enable_advanced_sort();
  342. $advancedsoftbtnposition = mpt_advanced_sort_btn_position();
  343.  
  344. $args = array(
  345. 'unique_id' => $unique_id,
  346. 'sort' => $advancedsoft,
  347. 'align' => $advancedsoftbtnposition,
  348. 'context' => $context,
  349. 'echo' => false,
  350. 'paginate' => true,
  351. 'per_page' => $entries,
  352. 'category' => ( $context == 'category' ? $unique_id : '' ),
  353. 'tag' => ( $context == 'tag' ? $unique_id : '' ),
  354. 'counter' => $counter,
  355. 'span' => $span,
  356. 'btnclass' => $btnclass,
  357. 'iconclass' => $iconclass,
  358. 'labelcolor' => $labelcolor
  359. );
  360.  
  361. echo apply_filters( 'func_pro_list_products' , pro_advance_product_sort( $args ) , $args );
  362. }
  363.  
  364. /* Comment Form functions
  365. ------------------------------------------------------------------------------------------------------------------- */
  366.  
  367. function pro_custom_comment_form($defaults) {
  368. $defaults['comment_notes_before'] = '';
  369. $defaults['id_form'] = 'pro-comment-form';
  370. $defaults['comment_field'] = '<textarea name="comment" id="comment" class="span12" rows="10" placeholder="'.__( 'Leave Your Comments Here' , 'pro' ).'"></textarea>';
  371. $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>';
  372.  
  373. return $defaults;
  374. }
  375.  
  376. function pro_custom_comment_fields() {
  377. $commenter = wp_get_current_commenter();
  378. $req = get_option('require_name_email');
  379. $aria_req = ( $req ? ' aria-required="true"' : '' );
  380.  
  381. $fields = array(
  382. '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' ) : '' ).'" />',
  383. '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>',
  384. 'url' => '<input type="text" id="url" name="url" value="'.esc_attr($commenter['comment_author_url']).'" class="span12" placeholder="'.__( 'Your Website URL (optional)' , 'pro' ).'" />',
  385.  
  386. );
  387.  
  388. return $fields;
  389. }
  390.  
  391. // list Comments callback function
  392. function pro_list_comments( $comment , $args , $depth ) {
  393.  
  394. $GLOBALS['comment'] = $comment;
  395.  
  396. ?>
  397.  
  398. <?php if ( get_comment_type() == 'pingback' || get_comment_type() == 'trackback') : ?>
  399.  
  400. <li id="comment-<?php comment_ID(); ?>">
  401. <div <?php comment_class('well well-small well-comment'); ?>>
  402.  
  403. <h4><?php _e( 'Pingback: ' , 'pro' ); ?></h4>
  404. <div class="comment-pingback">
  405. <?php echo apply_filters( 'pro_comment_pingback' , get_comment_author_link($comment->comment_ID) ); ?>
  406. </div>
  407.  
  408. <?php edit_comment_link(); ?>
  409.  
  410. </div><!-- End well-comment-->
  411.  
  412. <?php elseif ( get_comment_type() == 'comment' ) : ?>
  413.  
  414. <li id="comment-<?php comment_ID(); ?>">
  415. <div <?php comment_class('well well-small well-comment'); ?>>
  416.  
  417. <div class="comment-author">
  418.  
  419. <div class="comment-author-avatar">
  420. <?php
  421. $avatar_size = 48;
  422. if ( $comment->comment_parent != 0 ) {
  423. $avatar_size = 40;
  424. }
  425.  
  426. echo get_avatar($comment , $avatar_size);
  427. ?>
  428. <span class="comment-author-name"><?php comment_author_link(); ?></span>
  429. </div>
  430.  
  431. </div>
  432.  
  433. <div class="clear"></div>
  434.  
  435. <div class="comment-time"><?php comment_date(); ?> - <?php comment_time(); ?><?php edit_comment_link( __( 'edit' , 'pro' ) , ' ( ' , ' )' );?></div>
  436.  
  437. <?php if ($comment->comment_approved == '0') : ?>
  438.  
  439. <div class="comment-awaiting-approval">
  440. <?php echo apply_filters( 'pro_comment_awaiting_approval' , __( 'Your comment is awaiting moderation' , 'pro' ) ); ?>
  441. </div>
  442.  
  443. <?php else : ?>
  444.  
  445. <div class="comment-contents">
  446. <?php echo wpautop(get_comment_text($comment->comment_ID)); ?>
  447. </div>
  448.  
  449. <?php endif; ?>
  450.  
  451. <div class="comment-reply-button">
  452. <?php comment_reply_link(array_merge( $args , array( 'depth' => $depth , 'max_depth' => $args['max_depth'] ) ) ); ?>
  453. </div><!-- End comment-reply-button -->
  454.  
  455. </div><!-- End well-comment-->
  456. <?php endif;
  457. }
  458.  
  459. /* Search Form function
  460. ------------------------------------------------------------------------------------------------------------------- */
  461.  
  462. function pro_search_form( $form ) {
  463. $form = '<form role="search" class="form-search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  464. <label class="screen-reader-text" for="s">' . __( 'Search for:' , 'pro' ) . '</label>
  465. <div class="input-append">
  466. <input type="text" value="' . get_search_query() . '" class="input-medium" name="s" id="s" />
  467. <button type="submit" id="searchsubmit" class="btn">'. __( 'Search' , 'pro' ) .'</button>" />
  468. </div>
  469. </form>';
  470.  
  471. return $form;
  472. }
  473.  
  474. /* Default Product Image Filter
  475. ------------------------------------------------------------------------------------------------------------------- */
  476.  
  477. function pro_default_product_img( $image = '' ) {
  478. $default_img_url = esc_url( get_option('mpt_mp_default_product_img') );
  479. if ( !empty($default_img_url) )
  480. return $default_img_url;
  481. else
  482. return $image;
  483. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement