Advertisement
AngiCippi

function.php

Apr 18th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.18 KB | None | 0 0
  1. <?php
  2.  
  3. /********************* DEFINE MAIN PATHS ********************/
  4.  
  5. //error_reporting(-1);
  6.  
  7. define('Medico_PLUGINS', get_template_directory() . '/plugins' ); // Shortcut to the /plugins/ directory
  8.  
  9.  
  10.  
  11. $adminPath = get_template_directory() . '/library/admin/';
  12.  
  13. $funcPath = get_template_directory() . '/library/functions/';
  14.  
  15. $incPath = get_template_directory() . '/library/includes/';
  16.  
  17.  
  18.  
  19. global $alc_options;
  20.  
  21. $alc_options = isset($_POST['options']) ? $_POST['options'] : get_option('alc_general_settings');
  22.  
  23. /************************************************************/
  24.  
  25.  
  26.  
  27. /*********** LOAD ALL REQUIRED SCRIPTS AND STYLES ***********/
  28.  
  29. function Medico_load_scripts()
  30.  
  31. {
  32.  
  33. $alc_options = isset($_POST['options']) ? $_POST['options'] : get_option('alc_general_settings');
  34.  
  35. if( $GLOBALS['pagenow'] != 'wp-login.php' && !is_admin())
  36.  
  37. {
  38.  
  39. wp_enqueue_style('foundation-styles', get_template_directory_uri().'/css/foundation.min.css');
  40.  
  41. wp_enqueue_style('fgx-styles', get_template_directory_uri().'/css/fgx-foundation.css');
  42.  
  43. wp_enqueue_style('main-styles', get_stylesheet_directory_uri().'/style.css');
  44.  
  45. wp_enqueue_style('dynamic-styles', get_template_directory_uri().'/css/dynamic-styles.php');
  46.  
  47. wp_enqueue_style('revsilder', get_template_directory_uri().'/css/revslider.css');
  48.  
  49. wp_enqueue_style('normalize', get_template_directory_uri().'/plugins/prettyphoto/prettyPhoto.css');
  50.  
  51. wp_enqueue_style('dp-styles', get_template_directory_uri().'/css/datepicker/metallic.css');
  52.  
  53.  
  54.  
  55. // Font awesome styles
  56.  
  57. wp_enqueue_style('font-awesome', get_template_directory_uri().'/plugins/fontawesome/css/font-awesome.min.css');
  58.  
  59. wp_enqueue_style('nivo-slider-styles', get_template_directory_uri().'/css/nivo-slider.css');
  60.  
  61. wp_enqueue_style('nivo-default-styles', get_template_directory_uri().'/css/themes/default/default.css');
  62.  
  63.  
  64.  
  65. wp_enqueue_style('smallipop', get_template_directory_uri().'/plugins/smallipop/css/jquery.smallipop.css');
  66.  
  67. wp_enqueue_style('jplayer-styles', get_template_directory_uri().'/js/jplayer/skin/pink.flag/jplayer.pink.flag.css',false,'3.0.1','all');
  68.  
  69.  
  70.  
  71. // Register or enqueue scripts
  72.  
  73. wp_enqueue_script('jquery');
  74.  
  75. wp_enqueue_script('modernizr', get_template_directory_uri() .'/js/vendor/custom.modernizr.js', array('jquery'), '3.2', true);
  76.  
  77. wp_enqueue_script('foundation-min', get_template_directory_uri(). '/js/foundation.min.js');
  78.  
  79. wp_enqueue_script('quicksand', get_template_directory_uri() .'/js/jquery.quicksand.js', array('jquery'), '3.2', true);
  80.  
  81. wp_enqueue_script('jplayer-audio', get_template_directory_uri().'/js/jplayer/jquery.jplayer.min.js', array('jquery'), '3.2', true);
  82.  
  83. wp_enqueue_script('datepicker-js', get_template_directory_uri() .'/js/datepicker.js', array('jquery'), '3.2', true);
  84.  
  85. wp_enqueue_script('prettyphoto', get_template_directory_uri().'/plugins/prettyphoto/jquery.prettyPhoto.js', array('jquery'), '3.2', true);
  86.  
  87.  
  88.  
  89. wp_enqueue_script('prettify', get_template_directory_uri().'/plugins/smallipop/lib/contrib/prettify.js', array('jquery'), '3.2', true);
  90.  
  91. wp_enqueue_script('smallipop', get_template_directory_uri().'/plugins/smallipop/lib/jquery.smallipop.js', array('jquery'), '3.2', true);
  92.  
  93. wp_enqueue_script('smallipop-calls', get_template_directory_uri().'/plugins/smallipop/lib/smallipop.calls.js', array('jquery'), '3.2', true);;
  94.  
  95. wp_enqueue_script('carouFredSel', get_template_directory_uri(). '/plugins/carouFredSel/jquery.carouFredSel-6.2.0-packed.js', array('jquery'), '3.0.1' );
  96.  
  97. wp_enqueue_script('touchSwipe', get_template_directory_uri().'/plugins/carouFredSel/helper-plugins/jquery.touchSwipe.min.js', array('jquery'), '3.2', true);
  98.  
  99. wp_enqueue_script('bxslidermin', get_template_directory_uri() .'/js/jquery.bxslider.min.js', array('jquery'), '3.2', true);
  100.  
  101. wp_enqueue_script('nivo-slider', get_template_directory_uri() .'/js/jquery.nivo.slider.pack.js', array('jquery'), '3.2', true);
  102.  
  103. wp_enqueue_script('accordion-custom', get_template_directory_uri() .'/js/jquery.accordion.js', array('jquery'), '3.2', true);
  104.  
  105. wp_enqueue_script('flickr', get_template_directory_uri().'/plugins/flickr/jflickrfeed.min.js', array('jquery'), '3.2', true);
  106.  
  107. wp_enqueue_script('Validate', get_template_directory_uri().'/js/jquery.validate.min.js',array('jquery'), array('jquery'), '3.2', true);
  108.  
  109. wp_enqueue_script('app-head-js', get_template_directory_uri() .'/js/app-head-calls.js', array('jquery'), '3.2', true);
  110.  
  111. wp_enqueue_script('app-footer-js', get_template_directory_uri() .'/js/app-bottom-calls.js', array('jquery'), '3.2', true);
  112.  
  113.  
  114.  
  115. if (is_page_template('contact-template.php')){
  116.  
  117. $alc_options = get_option('alc_general_settings');
  118.  
  119. if (!empty($alc_options['alc_contact_address']))
  120.  
  121. {
  122.  
  123. wp_enqueue_script('Google-map-api', 'http://maps.google.com/maps/api/js?sensor=false');
  124.  
  125. wp_enqueue_script('Google-map', get_template_directory_uri().'/js/gmap3.min.js');
  126.  
  127. }
  128.  
  129. }
  130.  
  131. if (is_page_template('under-construction.php'))
  132.  
  133. {
  134.  
  135. wp_enqueue_script('Under-construction', get_template_directory_uri().'/js/jquery.countdown.js');
  136.  
  137. }
  138.  
  139. }
  140.  
  141. }
  142.  
  143. add_action( 'wp_enqueue_scripts', 'Medico_load_scripts' ); //Load All Scripts
  144.  
  145.  
  146.  
  147.  
  148.  
  149. /******************* LOAD GOOGLE FONTS **********************/
  150.  
  151.  
  152.  
  153. function Medico_fonts() {
  154.  
  155. $protocol = is_ssl() ? 'https' : 'http';
  156.  
  157. wp_enqueue_style( 'Medico-opensans', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400,700" );}
  158.  
  159. add_action( 'wp_enqueue_scripts', 'Medico_fonts' );
  160.  
  161.  
  162.  
  163. /************************************************************/
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171. /********************* DEFINE MAIN PATHS ********************/
  172.  
  173.  
  174.  
  175. require_once ($funcPath . 'helper.php');
  176.  
  177. require_once ($incPath . 'the_breadcrumb.php');
  178.  
  179. require_once ($incPath . 'OAuth.php');
  180.  
  181. require_once ($incPath . 'twitteroauth.php');
  182.  
  183. require_once ($incPath . 'portfolio_walker.php');
  184.  
  185. require_once ($funcPath . 'sidebar-generator.php');
  186.  
  187. require_once ($funcPath . 'options.php');
  188.  
  189. require_once ($funcPath . 'post-types.php');
  190.  
  191. require_once ($funcPath . 'widgets.php');
  192.  
  193. require_once ($funcPath . '/shortcodes/shortcode.php');
  194.  
  195. require_once ($adminPath . 'custom-fields.php');
  196.  
  197. require_once ($adminPath . 'scripts.php');
  198.  
  199. require_once ($adminPath . 'admin-panel/admin-panel.php');
  200.  
  201. // Redirect To Theme Options Page on Activation
  202.  
  203. if (is_admin() && isset($_GET['activated'])){
  204.  
  205. wp_redirect(admin_url('admin.php?page=adminpanel'));
  206.  
  207. }
  208.  
  209. /************************************************************/
  210.  
  211.  
  212.  
  213.  
  214.  
  215. /************** ADD SUPPORT FOR LOCALIZATION ***************/
  216.  
  217.  
  218.  
  219. load_theme_textdomain( 'Medico', get_template_directory() . '/languages' );
  220.  
  221.  
  222.  
  223. $locale = get_locale();
  224.  
  225.  
  226.  
  227. $locale_file = get_template_directory() . "/languages/$locale.php";
  228.  
  229. if ( is_readable( $locale_file ) )
  230.  
  231. require_once( $locale_file );
  232.  
  233.  
  234.  
  235. /************************************************************/
  236.  
  237.  
  238.  
  239.  
  240.  
  241. /**************** ADD SUPPORT FOR POST THUMBS ***************/
  242.  
  243.  
  244.  
  245. add_theme_support( 'post-thumbnails');
  246.  
  247. add_theme_support( 'woocommerce' );
  248.  
  249. // Define various thumbnail sizes
  250.  
  251. add_image_size('portfolio-4-col', 270, 190, true);
  252.  
  253. add_image_size('portfolio-3-col', 360, 240, true);
  254.  
  255. add_image_size('blog-list', 260, 170, true);
  256.  
  257. add_image_size('blog-thumb', 50, 50, true);
  258.  
  259.  
  260.  
  261. /************************************************************/
  262.  
  263.  
  264.  
  265.  
  266.  
  267. /*********** PORTFOLIO TAXONOMY PAGINATION FIX **************/
  268.  
  269. $option_posts_per_page = get_option( 'posts_per_page' );
  270.  
  271. add_action( 'init', 'my_modify_posts_per_page', 0);
  272.  
  273. function my_modify_posts_per_page() {
  274.  
  275. add_filter( 'option_posts_per_page', 'my_option_posts_per_page' );
  276.  
  277. }
  278.  
  279. function my_option_posts_per_page( $value ) {
  280.  
  281. global $option_posts_per_page;
  282.  
  283. if ( is_tax( 'portfolio_category') ) {
  284.  
  285. $pageId = get_page_ID_by_page_template('portfolio-template3.php');
  286.  
  287. if ($pageId)
  288.  
  289. {
  290.  
  291. $custom = get_post_custom($pageId);
  292.  
  293. $items_per_page = isset ($custom['_page_portfolio_num_items_page']) ? $custom['_page_portfolio_num_items_page'][0] : '777';
  294.  
  295. return $items_per_page;
  296.  
  297. }
  298.  
  299. else
  300.  
  301. {
  302.  
  303. return 4;
  304.  
  305. }
  306.  
  307. } else {
  308.  
  309. return $option_posts_per_page;
  310.  
  311. }
  312.  
  313. }
  314.  
  315. /************************************************************/
  316.  
  317.  
  318.  
  319.  
  320.  
  321. /************* ADD SUPPORT FOR WORDPRESS 3 MENUS ************/
  322.  
  323.  
  324.  
  325. add_theme_support( 'menus' );
  326.  
  327.  
  328.  
  329. //Register Navigations
  330.  
  331. add_action( 'init', 'my_custom_menus' );
  332.  
  333. function my_custom_menus() {
  334.  
  335. register_nav_menus(
  336.  
  337. array(
  338.  
  339. 'primary_nav' => __( 'Primary Navigation', 'Medico'),
  340.  
  341. 'top_nav' => __( 'Top Navigation', 'Medico')
  342.  
  343. )
  344.  
  345. );
  346.  
  347. }
  348.  
  349.  
  350.  
  351. /************* WOOCOMMERCE HOOKS AND CUSTOMIZATION ************/
  352.  
  353.  
  354.  
  355. remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
  356.  
  357. remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
  358.  
  359. add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 8;' ), 20 );
  360.  
  361.  
  362.  
  363. function woocommerce_remove_breadcrumb(){
  364.  
  365. remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
  366.  
  367. }
  368.  
  369. add_action('woocommerce_before_main_content', 'woocommerce_remove_breadcrumb');
  370.  
  371.  
  372.  
  373. function woocommerce_custom_breadcrumb(){
  374.  
  375. woocommerce_breadcrumb();
  376.  
  377. }
  378.  
  379. function my_woocommerce_breadcrumbs() {
  380.  
  381. return array(
  382.  
  383. 'delimiter' => '',
  384.  
  385. 'wrap_before' => '<ul class="breadcrumbs woo-breadcrumbs right" itemprop="breadcrumb">',
  386.  
  387. 'wrap_after' => '</ul>',
  388.  
  389. 'before' => '<li>',
  390.  
  391. 'after' => '</li>',
  392.  
  393. 'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
  394.  
  395. );
  396.  
  397. }
  398.  
  399. add_filter( 'woocommerce_breadcrumb_defaults', 'my_woocommerce_breadcrumbs' );
  400.  
  401.  
  402.  
  403. add_action( 'woo_custom_breadcrumb', 'woocommerce_custom_breadcrumb' );
  404.  
  405. add_filter('loop_shop_columns', 'loop_columns');
  406.  
  407. if (!function_exists('loop_columns')) {
  408.  
  409. function loop_columns() {
  410.  
  411. return 3; // 3 products per row
  412.  
  413. }
  414.  
  415. }
  416.  
  417. /************************************************************/
  418.  
  419. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement