Guest User

functions.php

a guest
Jan 21st, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.31 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter('tribe_events_event_schedule_details_formatting', 'uniform_date_format');
  4.  
  5. function uniform_date_format($settings) {
  6. $settings['same_year_format'] = get_option( 'date_format' );
  7. return $settings;
  8. }
  9.  
  10. global $avia_config;
  11.  
  12. /*
  13. * if you run a child theme and dont want to load the default functions.php file
  14. * set the global var bellow in you childthemes function.php to true:
  15. *
  16. * example: global $avia_config; $avia_config['use_child_theme_functions_only'] = true;
  17. * The default functions.php file will then no longer be loaded. You need to make sure then
  18. * to include framework and functions that you want to use by yourself.
  19. *
  20. * This is only recommended for advanced users
  21. */
  22.  
  23. if(isset($avia_config['use_child_theme_functions_only'])) return;
  24.  
  25. /*
  26. * create a global var which stores the ids of all posts which are displayed on the current page. It will help us to filter duplicate posts
  27. */
  28. $avia_config['posts_on_current_page'] = array();
  29.  
  30.  
  31. /*
  32. * wpml multi site config file
  33. * needs to be loaded before the framework
  34. */
  35.  
  36. require_once( 'config-wpml/config.php' );
  37.  
  38.  
  39. /*
  40. * These are the available color sets in your backend.
  41. * If more sets are added users will be able to create additional color schemes for certain areas
  42. *
  43. * The array key has to be the class name, the value is only used as tab heading on the styling page
  44. */
  45.  
  46. $avia_config['color_sets'] = array(
  47. 'header_color' => 'Header',
  48. 'main_color' => 'Main Content',
  49. 'alternate_color' => 'Alternate Content',
  50. 'footer_color' => 'Footer',
  51. 'socket_color' => 'Socket'
  52. );
  53.  
  54.  
  55.  
  56. /*
  57. * add support for responsive mega menus
  58. */
  59.  
  60. add_theme_support('avia_mega_menu');
  61.  
  62.  
  63. /*
  64. * deactivates the default mega menu and allows us to pass individual menu walkers when calling a menu
  65. */
  66.  
  67. add_filter('avia_mega_menu_walker', '__return_false');
  68.  
  69.  
  70. /*
  71. * adds support for the new avia sidebar manager
  72. */
  73.  
  74. add_theme_support('avia_sidebar_manager');
  75.  
  76.  
  77. ##################################################################
  78. # AVIA FRAMEWORK by Kriesi
  79.  
  80. # this include calls a file that automatically includes all
  81. # the files within the folder framework and therefore makes
  82. # all functions and classes available for later use
  83.  
  84. require_once( 'framework/avia_framework.php' );
  85.  
  86. ##################################################################
  87.  
  88.  
  89. /*
  90. * Register additional image thumbnail sizes
  91. * Those thumbnails are generated on image upload!
  92. *
  93. * If the size of an array was changed after an image was uploaded you either need to re-upload the image
  94. * or use the thumbnail regeneration plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/
  95. */
  96.  
  97. $avia_config['imgSize']['widget'] = array('width'=>36, 'height'=>36); // small preview pics eg sidebar news
  98. $avia_config['imgSize']['square'] = array('width'=>180, 'height'=>180); // small image for blogs
  99. $avia_config['imgSize']['featured'] = array('width'=>1500, 'height'=>430 ); // images for fullsize pages and fullsize slider
  100. $avia_config['imgSize']['extra_large'] = array('width'=>1500, 'height'=>1500 , 'crop' => false); // images for fullscrren slider
  101. $avia_config['imgSize']['portfolio'] = array('width'=>495, 'height'=>400 ); // images for portfolio entries (2,3 column)
  102. $avia_config['imgSize']['portfolio_small'] = array('width'=>260, 'height'=>185 ); // images for portfolio 4 columns
  103. $avia_config['imgSize']['gallery'] = array('width'=>710, 'height'=>575 ); // images for portfolio entries (2,3 column)
  104. $avia_config['imgSize']['masonry'] = array('width'=>705, 'height'=>705 , 'crop' => false); // images for fullscreen masonry
  105. $avia_config['imgSize']['entry_with_sidebar'] = array('width'=>710, 'height'=>270); // big images for blog and page entries
  106. $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1030, 'height'=>360 ); // images for fullsize pages and fullsize slider
  107.  
  108. //overwrite blog and fullwidth image on extra large layouts
  109. if(avia_get_option('responsive_layout') == "responsive responsive_large")
  110. {
  111. $avia_config['imgSize']['gallery'] = array('width'=>845, 'height'=>684 ); // images for portfolio entries (2,3 column)
  112. $avia_config['imgSize']['entry_with_sidebar'] = array('width'=>845, 'height'=>321); // big images for blog and page entries
  113. $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1210, 'height'=>423 ); // images for fullsize pages and fullsize slider
  114. }
  115.  
  116.  
  117.  
  118. $avia_config['selectableImgSize'] = array(
  119. 'square' => __('Square','avia_framework'),
  120. 'featured' => __('Featured','avia_framework'),
  121. 'portfolio' => __('Portfolio','avia_framework'),
  122. 'gallery' => __('Gallery','avia_framework'),
  123. 'entry_with_sidebar' => __('Entry with Sidebar','avia_framework'),
  124. 'entry_without_sidebar' => __('Entry without Sidebar','avia_framework'),
  125. 'extra_large' => __('Fullscreen Sections/Sliders','avia_framework'),
  126.  
  127. );
  128.  
  129. avia_backend_add_thumbnail_size($avia_config);
  130.  
  131. if ( ! isset( $content_width ) ) $content_width = $avia_config['imgSize']['featured']['width'];
  132.  
  133.  
  134.  
  135.  
  136. /*
  137. * register the layout sizes: the written number represents the grid size, if the elemnt should not have a left margin add "alpha"
  138. *
  139. * Calculation of the with: the layout is based on a twelve column grid system, so content + sidebar must equal twelve.
  140. * example: 'content' => 'nine alpha', 'sidebar' => 'three'
  141. *
  142. * if the theme uses fancy blog layouts ( meta data beside the content for example) use the meta and entry values.
  143. * calculation of those: meta + entry = content
  144. *
  145. */
  146.  
  147. $avia_config['layout']['fullsize'] = array('content' => 'twelve alpha', 'sidebar' => 'hidden', 'meta' => 'two alpha', 'entry' => 'eleven');
  148. $avia_config['layout']['sidebar_left'] = array('content' => 'nine', 'sidebar' => 'three alpha' ,'meta' => 'two alpha', 'entry' => 'nine');
  149. $avia_config['layout']['sidebar_right'] = array('content' => 'nine alpha', 'sidebar' => 'three alpha', 'meta' => 'two alpha', 'entry' => 'nine alpha');
  150.  
  151.  
  152.  
  153. /*
  154. * These are some of the font icons used in the theme, defined by the entypo icon font. the font files are included by the new aviaBuilder
  155. * common icons are stored here for easy retrieval
  156. */
  157.  
  158. $avia_config['font_icons'] = apply_filters('avf_default_icons', array(
  159.  
  160. //post formats
  161. 'standard' => array( 'font' =>'entypo-fontello', 'icon' => 'ue836'),
  162. 'link' => array( 'font' =>'entypo-fontello', 'icon' => 'ue822'),
  163. 'image' => array( 'font' =>'entypo-fontello', 'icon' => 'ue80f'),
  164. 'audio' => array( 'font' =>'entypo-fontello', 'icon' => 'ue801'),
  165. 'quote' => array( 'font' =>'entypo-fontello', 'icon' => 'ue833'),
  166. 'gallery' => array( 'font' =>'entypo-fontello', 'icon' => 'ue80e'),
  167. 'video' => array( 'font' =>'entypo-fontello', 'icon' => 'ue80d'),
  168.  
  169. //social
  170. 'behance' => array( 'font' =>'entypo-fontello', 'icon' => 'ue915'),
  171. 'dribbble' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8fe'),
  172. 'facebook' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8f3'),
  173. 'flickr' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8ed'),
  174. 'gplus' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8f6'),
  175. 'linkedin' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8fc'),
  176. 'instagram' => array( 'font' =>'entypo-fontello', 'icon' => 'ue909'),
  177. 'pinterest' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8f8'),
  178. 'skype' => array( 'font' =>'entypo-fontello', 'icon' => 'ue90d'),
  179. 'tumblr' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8fa'),
  180. 'twitter' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8f1'),
  181. 'vimeo' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8ef'),
  182. 'rss' => array( 'font' =>'entypo-fontello', 'icon' => 'ue853'),
  183. 'youtube' => array( 'font' =>'entypo-fontello', 'icon' => 'ue921'),
  184. 'xing' => array( 'font' =>'entypo-fontello', 'icon' => 'ue923'),
  185. 'soundcloud' => array( 'font' =>'entypo-fontello', 'icon' => 'ue913'),
  186. 'five_100_px' => array( 'font' =>'entypo-fontello', 'icon' => 'ue91d'),
  187. 'mail' => array( 'font' =>'entypo-fontello', 'icon' => 'ue805'),
  188.  
  189. //woocomemrce
  190. 'cart' => array( 'font' =>'entypo-fontello', 'icon' => 'ue859'),
  191. 'details' => array( 'font' =>'entypo-fontello', 'icon' => 'ue84b'),
  192.  
  193. //bbpress
  194. 'supersticky' => array( 'font' =>'entypo-fontello', 'icon' => 'ue808'),
  195. 'sticky' => array( 'font' =>'entypo-fontello', 'icon' => 'ue809'),
  196. 'one_voice' => array( 'font' =>'entypo-fontello', 'icon' => 'ue83b'),
  197. 'multi_voice' => array( 'font' =>'entypo-fontello', 'icon' => 'ue83c'),
  198. 'closed' => array( 'font' =>'entypo-fontello', 'icon' => 'ue824'),
  199. 'sticky_closed' => array( 'font' =>'entypo-fontello', 'icon' => 'ue808\ue824'),
  200. 'supersticky_closed' => array( 'font' =>'entypo-fontello', 'icon' => 'ue809\ue824'),
  201.  
  202. //navigation, slider & controls
  203. 'play' => array( 'font' =>'entypo-fontello', 'icon' => 'ue897'),
  204. 'pause' => array( 'font' =>'entypo-fontello', 'icon' => 'ue899'),
  205. 'next' => array( 'font' =>'entypo-fontello', 'icon' => 'ue879'),
  206. 'prev' => array( 'font' =>'entypo-fontello', 'icon' => 'ue878'),
  207. 'next_big' => array( 'font' =>'entypo-fontello', 'icon' => 'ue87d'),
  208. 'prev_big' => array( 'font' =>'entypo-fontello', 'icon' => 'ue87c'),
  209. 'close' => array( 'font' =>'entypo-fontello', 'icon' => 'ue814'),
  210. 'reload' => array( 'font' =>'entypo-fontello', 'icon' => 'ue891'),
  211. 'mobile_menu' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8a5'),
  212.  
  213. //image hover overlays
  214. 'ov_external' => array( 'font' =>'entypo-fontello', 'icon' => 'ue832'),
  215. 'ov_image' => array( 'font' =>'entypo-fontello', 'icon' => 'ue869'),
  216. 'ov_video' => array( 'font' =>'entypo-fontello', 'icon' => 'ue897'),
  217.  
  218.  
  219. //misc
  220. 'search' => array( 'font' =>'entypo-fontello', 'icon' => 'ue803'),
  221. 'info' => array( 'font' =>'entypo-fontello', 'icon' => 'ue81e'),
  222. 'clipboard' => array( 'font' =>'entypo-fontello', 'icon' => 'ue8d1'),
  223. 'scrolltop' => array( 'font' =>'entypo-fontello', 'icon' => 'ue876'),
  224.  
  225. ));
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232. add_theme_support( 'automatic-feed-links' );
  233.  
  234. ##################################################################
  235. # Frontend Stuff necessary for the theme:
  236. ##################################################################
  237. /*
  238. * Register theme text domain
  239. */
  240. if(!function_exists('avia_lang_setup'))
  241. {
  242. add_action('after_setup_theme', 'avia_lang_setup');
  243. function avia_lang_setup()
  244. {
  245. $lang = get_template_directory() . '/lang';
  246. load_theme_textdomain('avia_framework', $lang);
  247. }
  248. }
  249.  
  250.  
  251. /*
  252. * Register frontend javascripts:
  253. */
  254. if(!function_exists('avia_register_frontend_scripts'))
  255. {
  256. if(!is_admin()){
  257. add_action('wp_enqueue_scripts', 'avia_register_frontend_scripts');
  258. }
  259.  
  260. function avia_register_frontend_scripts()
  261. {
  262. $template_url = get_template_directory_uri();
  263. $child_theme_url = get_stylesheet_directory_uri();
  264.  
  265. //register js
  266. wp_register_script( 'avia-compat', $template_url.'/js/avia-compat.js', array('jquery'), 1, false ); //needs to be loaded at the top to prevent bugs
  267. wp_register_script( 'avia-default', $template_url.'/js/avia.js', array('jquery'), 1, true );
  268. wp_register_script( 'avia-shortcodes', $template_url.'/js/shortcodes.js', array('jquery'), 1, true );
  269. wp_register_script( 'avia-prettyPhoto', $template_url.'/js/prettyPhoto/js/jquery.prettyPhoto.js', 'jquery', "3.1.5", true);
  270. // wp_register_script( 'wp-mediaelement', $template_url.'/js/mediaelement/mediaelement-and-player.min.js', 'jquery', "1", true);
  271.  
  272. wp_enqueue_script( 'jquery' );
  273. wp_enqueue_script( 'avia-compat' );
  274. wp_enqueue_script( 'avia-default' );
  275. wp_enqueue_script( 'avia-shortcodes' );
  276. wp_enqueue_script( 'avia-prettyPhoto' );
  277. wp_enqueue_script( 'wp-mediaelement' );
  278.  
  279.  
  280. if ( is_singular() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
  281.  
  282.  
  283. //register styles
  284. wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), '1', 'screen' ); //register default style.css file. only include in childthemes. has no purpose in main theme
  285. wp_register_style( 'avia-grid' , $template_url."/css/grid.css", array(), '1', 'screen' );
  286. wp_register_style( 'avia-base' , $template_url."/css/base.css", array(), '1', 'screen' );
  287. wp_register_style( 'avia-layout', $template_url."/css/layout.css", array(), '1', 'screen' );
  288. wp_register_style( 'avia-scs', $template_url."/css/shortcodes.css", array(), '1', 'screen' );
  289. wp_register_style( 'avia-custom', $template_url."/css/custom.css", array(), '1', 'screen' );
  290. wp_register_style( 'avia-prettyP', $template_url."/js/prettyPhoto/css/prettyPhoto.css", array(), '1', 'screen' );
  291. wp_register_style( 'avia-media' , $template_url."/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen' );
  292.  
  293.  
  294. //register styles
  295.  
  296. wp_enqueue_style( 'avia-grid');
  297. wp_enqueue_style( 'avia-base');
  298. wp_enqueue_style( 'avia-layout');
  299. wp_enqueue_style( 'avia-scs');
  300. wp_enqueue_style( 'avia-prettyP');
  301. wp_enqueue_style( 'avia-media');
  302.  
  303.  
  304.  
  305. global $avia;
  306. $safe_name = avia_backend_safe_string($avia->base_data['prefix']);
  307.  
  308. if( get_option('avia_stylesheet_exists'.$safe_name) == 'true' )
  309. {
  310. $avia_upload_dir = wp_upload_dir();
  311.  
  312. $avia_dyn_stylesheet_url = $avia_upload_dir['baseurl'] . '/dynamic_avia/'.$safe_name.'.css';
  313. wp_register_style( 'avia-dynamic', $avia_dyn_stylesheet_url, array(), '1', 'screen' );
  314. wp_enqueue_style( 'avia-dynamic');
  315. }
  316.  
  317. wp_enqueue_style( 'avia-custom');
  318.  
  319.  
  320. if($child_theme_url != $template_url)
  321. {
  322. wp_enqueue_style( 'avia-style');
  323. }
  324.  
  325. }
  326. }
  327.  
  328.  
  329. if(!function_exists('avia_remove_default_video_styling'))
  330. {
  331. if(!is_admin()){
  332. add_action('wp_footer', 'avia_remove_default_video_styling', 1);
  333. }
  334.  
  335. function avia_remove_default_video_styling()
  336. {
  337. //remove default style for videos
  338. wp_dequeue_style( 'mediaelement' );
  339. //wp_dequeue_style( 'wp-mediaelement' );
  340. }
  341. }
  342.  
  343.  
  344.  
  345.  
  346. /*
  347. * Activate native wordpress navigation menu and register a menu location
  348. */
  349. if(!function_exists('avia_nav_menus'))
  350. {
  351. function avia_nav_menus()
  352. {
  353. global $avia_config;
  354.  
  355. add_theme_support('nav_menus');
  356. foreach($avia_config['nav_menus'] as $key => $value){ register_nav_menu($key, THEMENAME.' '.$value); }
  357. }
  358.  
  359. $avia_config['nav_menus'] = array( 'avia' => 'Main Menu' ,
  360. 'avia2' => 'Secondary Menu <br/><small>(Will be displayed if you selected a header layout that supports a submenu <a target="_blank" href="'.admin_url('?page=avia#goto_header').'">here</a>)</small>',
  361. 'avia3' => 'Footer Menu <br/><small>(no dropdowns)</small>'
  362. );
  363. avia_nav_menus(); //call the function immediatly to activate
  364. }
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374. /*
  375. * load some frontend functions in folder include:
  376. */
  377.  
  378. require_once( 'includes/admin/register-portfolio.php' ); // register custom post types for portfolio entries
  379. require_once( 'includes/admin/register-widget-area.php' ); // register sidebar widgets for the sidebar and footer
  380. require_once( 'includes/loop-comments.php' ); // necessary to display the comments properly
  381. require_once( 'includes/helper-template-logic.php' ); // holds the template logic so the theme knows which tempaltes to use
  382. require_once( 'includes/helper-social-media.php' ); // holds some helper functions necessary for twitter and facebook buttons
  383. require_once( 'includes/helper-post-format.php' ); // holds actions and filter necessary for post formats
  384. require_once( 'includes/helper-markup.php' ); // holds the markup logic (schema.org and html5)
  385. require_once( 'includes/admin/register-plugins.php'); // register the plugins we need
  386.  
  387. if(current_theme_supports('avia_conditionals_for_mega_menu'))
  388. {
  389. require_once( 'includes/helper-conditional-megamenu.php' ); // holds the walker for the responsive mega menu
  390. }
  391.  
  392. require_once( 'includes/helper-responsive-megamenu.php' ); // holds the walker for the responsive mega menu
  393.  
  394.  
  395.  
  396.  
  397. //adds the plugin initalization scripts that add styles and functions
  398.  
  399. if(!current_theme_supports('deactivate_layerslider')) require_once( 'config-layerslider/config.php' );//layerslider plugin
  400.  
  401. require_once( 'config-bbpress/config.php' ); //compatibility with bbpress forum plugin
  402. require_once( 'config-templatebuilder/config.php' ); //templatebuilder plugin
  403. require_once( 'config-gravityforms/config.php' ); //compatibility with gravityforms plugin
  404. require_once( 'config-woocommerce/config.php' ); //compatibility with woocommerce plugin
  405. require_once( 'config-wordpress-seo/config.php' ); //compatibility with Yoast WordPress SEO plugin
  406.  
  407.  
  408.  
  409. /*
  410. * dynamic styles for front and backend
  411. */
  412. if(!function_exists('avia_custom_styles'))
  413. {
  414. function avia_custom_styles()
  415. {
  416. require_once( 'includes/admin/register-dynamic-styles.php' ); // register the styles for dynamic frontend styling
  417. avia_prepare_dynamic_styles();
  418. }
  419.  
  420. add_action('init', 'avia_custom_styles', 20);
  421. add_action('admin_init', 'avia_custom_styles', 20);
  422. }
  423.  
  424.  
  425.  
  426.  
  427. /*
  428. * activate framework widgets
  429. */
  430. if(!function_exists('avia_register_avia_widgets'))
  431. {
  432. function avia_register_avia_widgets()
  433. {
  434. register_widget( 'avia_newsbox' );
  435. register_widget( 'avia_portfoliobox' );
  436. register_widget( 'avia_socialcount' );
  437. register_widget( 'avia_combo_widget' );
  438. register_widget( 'avia_partner_widget' );
  439. register_widget( 'avia_google_maps' );
  440. }
  441.  
  442. avia_register_avia_widgets(); //call the function immediatly to activate
  443. }
  444.  
  445.  
  446.  
  447. /*
  448. * add post format options
  449. */
  450. add_theme_support( 'post-formats', array('link', 'quote', 'gallery','video','image','audio' ) );
  451.  
  452.  
  453.  
  454. /*
  455. * Remove the default shortcode function, we got new ones that are better ;)
  456. */
  457. add_theme_support( 'avia-disable-default-shortcodes', true);
  458.  
  459.  
  460. /*
  461. * compat mode for easier theme switching from one avia framework theme to another
  462. */
  463. add_theme_support( 'avia_post_meta_compat');
  464.  
  465.  
  466. /*
  467. * make sure that enfold widgets dont use the old slideshow parameter in widgets, but default post thumbnails
  468. */
  469. add_theme_support('force-post-thumbnails-in-widget');
  470.  
  471.  
  472. /*
  473. * register custom functions that are not related to the framework but necessary for the theme to run
  474. */
  475.  
  476. require_once( 'functions-enfold.php');
Advertisement
Add Comment
Please, Sign In to add comment