SHARE
TWEET

functions.php

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