36, 'height'=>36 ); // small preview pics eg sidebar news $avia_config['imgSize']['post-format-image'] = array('width'=>630, 'height'=>999, 'crop'=>false); // big images for post format image and gallery posts $avia_config['imgSize']['fullsize'] = array('width'=>930, 'height'=>930, 'crop'=>false); // big images for lightbox and portfolio single entries $avia_config['imgSize']['featured'] = array('width'=>930, 'height'=>340); // images for fullsize pages and fullsize slider $avia_config['imgSize']['portfolio'] = array('width'=>450, 'height'=>335); // images for portfolio entries (2,3,4 column) //dynamic columns $avia_config['imgSize']['dynamic_1'] = array('width'=>446, 'height'=>151); // images for 2/4 (aka 1/2) dynamic portfolio columns when using 3 columns $avia_config['imgSize']['dynamic_2'] = array('width'=>609, 'height'=>210); // images for 2/3 dynamic portfolio columns $avia_config['imgSize']['dynamic_3'] = array('width'=>688, 'height'=>151); // images for 3/4 dynamic portfolio columns avia_backend_add_thumbnail_size($avia_config); ################################################################## # Frontend Stuff necessary for the theme: ################################################################## $lang = TEMPLATEPATH . '/lang'; load_theme_textdomain('avia_framework', $lang); /* Register frontend javascripts: */ if(!is_admin()){ add_action('init', 'avia_frontend_js'); } if(!function_exists('avia_frontend_js')) { function avia_frontend_js() { wp_register_script( 'avia-default', AVIA_BASE_URL.'js/avia.js', array('jquery','avia-html5-video'), 1, false ); wp_register_script( 'avia-prettyPhoto', AVIA_BASE_URL.'js/prettyPhoto/js/jquery.prettyPhoto.js', 'jquery', "3.0.1", true); wp_register_script( 'avia-html5-video', AVIA_BASE_URL.'js/projekktor/projekktor.min.js', 'jquery', "1", true); wp_register_script( 'adaptavia-slider', AVIA_BASE_URL.'js/adaptavia.js', 'jquery', "1.0.0", true); } } /* Activate native wordpress navigation menu and register a menu location */ add_theme_support('nav_menus'); $avia_config['nav_menus'] = array('avia' => 'Main Menu', 'avia2'=> 'Sub Menu'); foreach($avia_config['nav_menus'] as $key => $value){ register_nav_menu($key, THEMENAME.' '.$value); } //adds the plugin initalization scripts that add styles and functions require_once( 'config-woocommerce/config.php' ); //woocommerce shop plugin require_once( 'config-bbpress/config.php' ); //bbpress forum plugin //load some frontend functions in folder include: require_once( 'includes/admin/register-portfolio.php' ); // register custom post types for portfolio entries require_once( 'includes/admin/register-widget-area.php' ); // register sidebar widgets for the sidebar and footer require_once( 'css/dynamic-css.php' ); // register the styles for dynamic frontend styling require_once( 'includes/admin/register-shortcodes.php' ); // register wordpress shortcodes require_once( 'includes/loop-comments.php' ); // necessary to display the comments properly require_once( 'includes/helper-slideshow.php' ); // holds the class that generates the 2d & 3d slideshows, as well as feature images require_once( 'includes/helper-templates.php' ); // holds some helper functions necessary for dynamic templates require_once( 'includes/admin/compat.php' ); // compatibility functions for 3rd party plugins require_once( 'includes/admin/register-plugins.php'); // register the plugins we need //activate framework widgets register_widget( 'avia_tweetbox'); register_widget( 'avia_newsbox' ); register_widget( 'avia_portfoliobox' ); register_widget( 'avia_socialcount' ); register_widget( 'avia_combo_widget' ); register_widget( 'avia_partner_widget' ); //add post format options add_theme_support( 'post-formats', array('link', 'quote', 'gallery' ) ); ###################################################################### # CUSTOM THEME FUNCTIONS ###################################################################### //call functions for the theme add_filter('the_content_more_link', 'avia_remove_more_jump_link'); add_post_type_support('page', 'excerpt'); //allow mp4, webm and ogv file uploads add_filter('upload_mimes','avia_upload_mimes'); function avia_upload_mimes($mimes){ return array_merge($mimes, array ('mp4' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm')); } //change default thumbnail size on theme activation add_action('avia_backend_theme_activation', 'avia_set_thumb_size'); function avia_set_thumb_size() {update_option( 'thumbnail_size_h', 80 ); update_option( 'thumbnail_size_w', 80 );} //remove post thumbnails from page and posts add_theme_support( 'post-thumbnails' ); add_action('posts_selection', 'avia_remove_post_thumbnails'); add_action('init', 'avia_remove_post_thumbnails'); if(!function_exists('avia_remove_post_thumbnails')) { function avia_remove_post_thumbnails() { global $post_type; $remove_when = array('post','page','portfolio','product'); if(is_admin()) { foreach($remove_when as $remove) { if($post_type == $remove || (isset($_GET['post_type']) && $_GET['post_type'] == $remove)) { remove_theme_support( 'post-thumbnails' ); }; } } } } /*advanced title + breadcrumb function*/ if(!function_exists('avia_title')) { function avia_title($title = "", $product = "", $meta = true) { if(is_object($title)) $title = $title->post_title; if(!$title) $title = get_the_title(avia_get_the_id()); $extraClass = ""; if(!$meta) $extraClass = "no_padding_title"; echo "
"; echo '

'.$title.'

'; echo "
"; /* * display the theme search form * the tempalte file that is called is searchform.php in case you want to edit it */ if($meta === true) { get_search_form(); echo ''; } else if(function_exists($meta)) { $meta(); } echo "
"; echo "
"; } } if(!function_exists('avia_flag')) { /*crates the hr separator with the colored flag by using divs without images. Therefore complete color customization from the backend is possible */ function avia_flag($text = "", $class = "") { $output = ""; $output .= '
'; if($text !== false) { $output .= '
'; $output .= ' '.$text.''; $output .= ' '; $output .= ' '; $output .= '
'; } $output .= ' '; $output .= ' '; $output .= '
'; return $output; } } if(!function_exists('avia_banner')) { function avia_banner($position) { $extraClass = ""; $output = ""; $cookieHash = ""; $bannerText = avia_get_option('banner'); $cookieName = THEMENAME.'_avia_banner'; $bannerHash = md5($bannerText); if($position) $extraClass = 'relative_pos'; if(!empty($_COOKIE[$cookieName])) $cookieHash = $_COOKIE[$cookieName]; $output .= "
"; if(trim($bannerText) != "" && $bannerHash != $cookieHash) { $output .= ""; } $output .= "
"; echo $output; } } if(!function_exists('avia_shop_banner')) { function avia_shop_banner() { $pos = false; $output = ""; $sub = $cart = $menu = ""; if(avia_woocommerce_enabled()) { $sub = $cart = avia_woocommerce_cart_dropdown(); } $sub .= ""; $output .= "
"; if($cart || $menu) { $output .= $sub; } else { $pos = true; } $output .= "
"; echo $output; return $pos; } } //set post excerpt to be visible on theme acivation in user backend add_action('avia_backend_theme_activation', 'avia_show_menu_description'); if(!function_exists('avia_show_menu_description')) { function avia_show_menu_description() { global $current_user; get_currentuserinfo(); $old_meta_data = $meta_data = get_user_meta($current_user->ID, 'metaboxhidden_page', true); if(is_array($meta_data) && isset($meta_data[0])) { $key = array_search('postexcerpt', $meta_data); if($key !== false) { unset($meta_data[$key]); update_user_meta( $current_user->ID, 'metaboxhidden_page', $meta_data, $old_meta_data ); } } else { update_user_meta( $current_user->ID, 'metaboxhidden_page', array('postcustom', 'commentstatusdiv', 'commentsdiv', 'slugdiv', 'authordiv', 'revisionsdiv') ); } } } //import the dynamic frontpage template on theme installation add_action('avia_backend_theme_activation', 'avia_default_dynamics'); add_action('avia_ajax_reset_options_page', 'avia_default_dynamics'); if(!function_exists('avia_default_dynamics')) { function avia_default_dynamics() { global $avia; $firstInstall = get_option($avia->option_prefix.'_dynamic_elements'); if(empty($firstInstall)) { $custom_export = "dynamic_elements"; require_once AVIA_PHP . 'inc-avia-importer.php'; if(isset($_GET['page']) && $_GET['page'] == 'templates') { wp_redirect( $_SERVER['REQUEST_URI'] ); exit(); } } } } /*wordpress 3.4 changed 404 check - this is the mod for the avia framework to operate*/ function avia_disable_404( $query = false ) { global $avia_config, $wp_query; if(!isset($avia_config['first_query_run']) && is_front_page() && is_paged()) { $wp_query->is_paged = false; $avia_config['first_query_run'] = true; add_action( 'wp', 'avia_enable_404' ); } } function avia_enable_404() { global $wp_query; $wp_query->is_paged = true; } add_action( 'pre_get_posts', 'avia_disable_404' ,1 ,10000); function remove_dashboard_widgets(){ global$wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); } add_action('wp_dashboard_setup', 'remove_dashboard_widgets'); function modify_footer_admin () { echo 'Created by Artsjok.'; } add_filter('admin_footer_text', 'modify_footer_admin'); function fb_like( $atts, $content=null ){ /* Author: Nicholas P. Iler * URL: http://www.ilertech.com/2011/06/add-facebook-like-button-to-wordpress-3-0-with-a-simple-shortcode/ */ extract(shortcode_atts(array( 'send' => 'false', 'layout' => 'standard', 'show_faces' => 'true', 'width' => '400px', 'action' => 'like', 'font' => '', 'colorscheme' => 'light', 'ref' => '', 'locale' => 'en_US', 'appId' => '' // Put your AppId here is you have one ), $atts)); $fb_like_code = << HTML; return $fb_like_code; } add_shortcode('fb', 'fb_like'); //function remove reviews remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30); remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 3);