Advertisement
Guest User

Untitled

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