Advertisement
Guest User

Untitled

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