Advertisement
Guest User

functions.php

a guest
Oct 8th, 2015
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 22.41 KB | None | 0 0
  1. <?php
  2. /* CONSTANTS */
  3. define('ANPS_TEMPLATE_LANG', 'altus');
  4. global $no_container;
  5. $no_container = false;
  6.  
  7. /* Override vc tabs */
  8. include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  9. if ( is_plugin_active( 'js_composer/js_composer.php' ) ) {
  10.     function vc_theme_rows($atts, $content) {
  11.         $extra_class = '';
  12.         $extra_id = '';
  13.         $matches = array();
  14.  
  15.         global $no_container, $row_inner, $text_only;
  16.  
  17.         if ( $row_inner ) {
  18.             return vc_theme_rows_inner($atts, $content);
  19.         }
  20.  
  21.         if ( $text_only ) {
  22.             return wpb_js_remove_wpautop($content);
  23.         }
  24.  
  25.         /* Check for any user added styles */
  26.  
  27.         $css = '';
  28.         if( isset($atts['css']) ) {
  29.             $css = $atts['css'];
  30.         }
  31.  
  32.         $temp = preg_match('/\.vc_custom_(.*?){/s', $css, $matches);
  33.         if(!empty($matches)) {
  34.             $temp = $matches[1];
  35.  
  36.             if( $temp ) {
  37.                 $extra_class .= ' vc_custom_' . $temp;
  38.             }
  39.         }
  40.  
  41.         /* Check for any user added classes */
  42.  
  43.         if(isset($atts['el_class']) && $atts['el_class']) {
  44.             $extra_class .= ' '. $atts['el_class'];
  45.         }
  46.  
  47.         /* Check for any user added IDs */
  48.  
  49.         if(isset($atts['id']) && $atts['id']) {
  50.             $extra_id = 'id= "'. $atts['id'].'"';
  51.         }
  52.  
  53.         $coming_soon = get_option('coming_soon', '0');
  54.  
  55.         if($coming_soon=="0"||is_super_admin()) {
  56.             if(!isset($atts['has_content']) || $atts['has_content']=="true") {
  57.                 /* Content inside a container */
  58.                 $no_container = false;
  59.                 $no_top_margin = '';
  60.                 if( strpos($extra_class, 'no-top-margin') ) {
  61.                     $no_top_margin = ' no-top-margin';
  62.                 }
  63.                 return '<section class="container' . $no_top_margin .'"><div '.$extra_id.' class="row' . $extra_class . '">'.wpb_js_remove_wpautop($content).'</div></section>';
  64.             }
  65.             elseif($atts['has_content']=="inside") {
  66.                 $no_container = false;
  67.                 return '<section '.$extra_id.' class="' . $extra_class . '"><div class="container no-margin"><div class="row">'.wpb_js_remove_wpautop($content).'</div></div></section>';
  68.             }
  69.             else {
  70.                 /* Fullwidth Content */
  71.                 $no_container = true;
  72.                 return '<section '.$extra_id.' class="row no-margin' . $extra_class . '">'.wpb_js_remove_wpautop($content).'</section>';
  73.             }
  74.         } else {
  75.             /* No wrappers, only when Cooming soon is active */
  76.             $no_container = true;
  77.             return wpb_js_remove_wpautop($content);
  78.         }
  79.     }
  80.     function vc_theme_rows_inner($atts, $content) {
  81.  
  82.         /* Check for any user added styles */
  83.  
  84.         $style = "";
  85.         $css = '';
  86.  
  87.         if( isset($atts['css']) ) {
  88.             $css = $atts['css'];
  89.         }
  90.  
  91.         $temp = preg_match('/{(.*?)}/s', $css, $matches);
  92.         if(!empty($matches)) {
  93.             $temp = $matches[1];
  94.             if( $temp ) {
  95.                 $style = ' style="' . $temp . '"';
  96.             }
  97.         }
  98.  
  99.         return '<div class="row"' . $style . '>'.wpb_js_remove_wpautop($content).'</div>';
  100.     }
  101.     function vc_theme_columns($atts, $content = null) {
  102.         if( !isset($atts['width']) ) {
  103.             $width = '1/1';
  104.         } else {
  105.             $width = explode('/', $atts['width']);
  106.         }
  107.  
  108.         global $no_container, $text_only;
  109.        
  110.         if($width[1] > 0) {
  111.             $col = (12/$width[1])*$width[0];
  112.         } else {
  113.             $col = 12;
  114.         }
  115.         $extra_class = '';
  116.  
  117.         if(isset($atts['el_class']) && $atts['el_class']) {
  118.             $extra_class = ' ' . $atts['el_class'];
  119.         }
  120.        
  121.         if($col!=12) {
  122.             return '<div class="col-md-' . $col . $extra_class . '">'.wpb_js_remove_wpautop($content).'</div>';
  123.         }
  124.         elseif ( $no_container || $text_only ) {
  125.             return wpb_js_remove_wpautop($content);
  126.         }
  127.         else {
  128.             return '<div class="col-md-' . $col . $extra_class . '">'.wpb_js_remove_wpautop($content).'</div>';
  129.        }
  130.     }
  131.     function vc_theme_vc_row($atts, $content = null) {
  132.         return vc_theme_rows($atts, $content);
  133.     }
  134.     function vc_theme_vc_row_inner($atts, $content = null) {
  135.         return vc_theme_rows_inner($atts, $content);
  136.     }
  137.     function vc_theme_vc_column($atts, $content = null) {
  138.         return vc_theme_columns($atts, $content);
  139.     }
  140.     function vc_theme_vc_column_inner($atts, $content = null) {
  141.         return vc_theme_columns($atts, $content);
  142.     }
  143.     function vc_theme_vc_tabs($atts, $content = null) {
  144.         $content2 = str_replace("vc_tab", "tab", $content);
  145.         if(!isset($atts['type'])) {
  146.             $atts['type'] = "";
  147.         } else {
  148.             $atts['type'] = $atts['type'];
  149.         }
  150.         return do_shortcode("[tabs type='".$atts['type']."']".$content2."[/tabs]");
  151.     }
  152.     function vc_theme_vc_column_text($atts, $content = null) {
  153.         $extra_class = '';
  154.  
  155.         /* Check for any user added styles */
  156.  
  157.         $css = '';
  158.         if( isset($atts['css']) ) {
  159.             $css = $atts['css'];
  160.         }
  161.  
  162.         $temp = preg_match('/\.vc_custom_(.*?){/s', $css, $matches);
  163.         if(!empty($matches)) {
  164.             $temp = $matches[1];
  165.  
  166.             if( $temp ) {
  167.                 $extra_class .= ' vc_custom_' . $temp;
  168.             }
  169.         }
  170.  
  171.         return '<div class="text' . $extra_class . '">' . do_shortcode(force_balance_tags($content)) . '</div>';
  172.     }
  173. }
  174.  
  175. /* Image sizes */
  176. add_theme_support('post-thumbnails');
  177.  
  178. /* team */
  179. add_image_size('team-4', 270, 263, false);
  180. add_image_size('team-3', 370, 360, false);
  181. // Blog views
  182. add_image_size('blog-one-sidebar', 778, 285, true);
  183. add_image_size('blog-grid', 720, 412, true);
  184. add_image_size('blog-full', 1200, 439, true);
  185. add_image_size('blog-masonry-3-columns', 360, 0, false);
  186. add_image_size('blog-masonry-4-columns', 263, 0, false);
  187. // Recent blog, portfolio
  188. add_image_size('post-thumb', 360, 267, true);
  189. // Recent portfolio
  190. add_image_size('portfolio-thumb', 500, 371, true);
  191. // Portfolio random grid
  192. add_image_size('portfolio-random-width-2', 554, 202, true);
  193. add_image_size('portfolio-random-height-2', 262, 433, true);
  194. add_image_size('portfolio-random-width-2-height-2', 554, 433, true);
  195.  
  196. if(!is_admin()) {
  197.     include_once get_template_directory().'/anps-framework/classes/Options.php';
  198.     include_once get_template_directory().'/anps-framework/classes/Contact.php';
  199.     $anps_page_data = $options->get_page_setup_data();
  200.     $anps_options_data = $options->get_page_data();
  201.     $anps_media_data = $options->get_media();
  202.     $anps_social_data = $options->get_social();
  203.     $anps_contact_data = $contact->get_data();
  204.     $anps_shop_data = $options->get_shop_setup_data();
  205. }
  206. /* Include helper.php */
  207. include_once get_template_directory().'/anps-framework/helpers.php';
  208. if (!isset($content_width)) {
  209.     $content_width = 967;
  210. }
  211. add_filter('widget_text', 'do_shortcode');
  212. /* Widgets */
  213. include_once 'anps-framework/widgets/widgets.php';
  214. /* Shortcodes */
  215. include_once 'anps-framework/shortcodes.php';
  216. if (is_admin()) {
  217.     include_once 'shortcodes/shortcodes_init.php';
  218. }
  219. /* On setup theme */
  220. add_action('after_setup_theme', 'anps_register_custom_fonts');
  221. function anps_register_custom_fonts() {
  222.     if (!isset($_GET['stylesheet'])) {
  223.         $_GET['stylesheet'] = '';
  224.     }
  225.     $theme = wp_get_theme($_GET['stylesheet']);
  226.     if (!isset($_GET['activated'])) {
  227.         $_GET['activated'] = '';
  228.     }
  229.     if ($_GET['activated'] == 'true' && $theme->get_template() == ANPS_TEMPLATE_LANG) {
  230.         include_once get_template_directory().'/anps-framework/classes/Options.php';
  231.         include_once get_template_directory().'/anps-framework/classes/Style.php';
  232.         /* Add google fonts*/
  233.         if(get_option('anps_google_fonts', '')=='') {
  234.             $style->update_gfonts_install();
  235.         }
  236.         /* Add custom fonts to options */
  237.         $style->get_custom_fonts();
  238.         /* Add default fonts */
  239.         if(get_option('font_type_1', '')=='') {
  240.             update_option("font_type_1", "titillium");
  241.         }
  242.         if(get_option('font_type_2', '')=='') {
  243.             update_option("font_type_2", "Arial");
  244.         }
  245.     }
  246.     $fonts_installed = get_option('fonts_intalled');
  247.    
  248.     if($fonts_installed==1)
  249.         return;
  250.    
  251.     /* Get custom font */
  252.     include_once get_template_directory().'/anps-framework/classes/Style.php';
  253.     $fonts = $style->get_custom_fonts();
  254.     /* Update custom font */
  255.     foreach($fonts as $name=>$value) {
  256.         $arr_save[] = array('value'=>$value, 'name'=>$name);
  257.     }
  258.     update_option('anps_custom_fonts', $arr_save);
  259.     update_option('fonts_intalled', 1);
  260. }
  261. /* Team */
  262. include_once 'anps-framework/team.php';
  263. add_action('init', 'anps_team');
  264. function anps_team() {
  265.     new Team();
  266. }
  267. /* Team metaboxes */
  268. include_once 'anps-framework/team_meta.php';
  269. /* Portfolio metaboxes */
  270. include_once 'anps-framework/portfolio_meta.php';
  271. /* Portfolio */
  272. include_once 'anps-framework/portfolio.php';
  273. add_action('init', 'anps_portfolio');
  274. function anps_portfolio() {
  275.     new Portfolio();
  276. }
  277. /* Portfolio metaboxes */
  278. include_once 'anps-framework/metaboxes.php';
  279. /* Menu metaboxes */
  280. include_once 'anps-framework/menu_meta.php';
  281. /* Heading metaboxes */
  282. include_once 'anps-framework/heading_meta.php';
  283. /* Featured video metabox */
  284. include_once 'anps-framework/featured_video_meta.php';
  285.  
  286. //install paralax slider
  287. include_once 'anps-framework/install_plugins.php';
  288. add_editor_style('css/editor-style.php');
  289. /* Admin bar theme options menu */
  290. include_once 'anps-framework/classes/adminBar.php';
  291. /* PHP header() NO ERRORS */
  292. if (is_admin())
  293.     add_action('init', 'anps_do_output_buffer');
  294. function anps_do_output_buffer() {
  295.     ob_start();
  296. }
  297. remove_action( 'admin_notices', 'woothemes_updater_notice' );
  298. /* Infinite scroll 08.07.2013 */
  299. function anps_infinite_scroll_init() {
  300.     add_theme_support( 'infinite-scroll', array(
  301.         'type'       => 'click',
  302.         'footer_widgets' => true,
  303.         'container'  => 'section-content',
  304.         'footer'     => 'site-footer',
  305.     ) );
  306. }
  307. add_action( 'init', 'anps_infinite_scroll_init' );
  308. /* MegaMenu */
  309. class description_walker extends Walker_Nav_Menu
  310. {
  311.     function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0) {
  312.         global $anps_options_data;
  313.         if( isset($anps_options_data['one_page']) && $anps_options_data['one_page']=="on") {
  314.             $menu_separate = get_post_meta($item->object_id, $key ='anps_menu_separate', $single = true);
  315.             if($menu_separate=="1" || ($item->object!="page" && get_home_url()!=$item->url)) {
  316.                 $item->url = $item->url;
  317.             } else {
  318.                 $post = get_post($item->object_id );
  319.                 $slug = $post->post_name;
  320.                 if(is_front_page()) {
  321.                     $item->url = "#".$slug;
  322.                 } else {
  323.                     $item->url = get_site_url()."/#".$slug;
  324.                 }
  325.             }
  326.         }
  327.         global $wp_query;
  328.         $menu_style = get_option('menu_style', '1');
  329.         if( isset($_GET['header']) && $_GET['header'] == 'type-2' ) {
  330.             $menu_style = '2';
  331.         }
  332.         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  333.         $class_names = $value = '';
  334.         $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  335.         $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
  336.         $class_names = ' class="'. esc_attr( $class_names ) . '"';
  337.  
  338.         $output .= $indent . '<li' . $value . $class_names .'>';
  339.         $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
  340.         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
  341.         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
  342.         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url       ) .'"' : '';
  343.         $description  = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
  344.         $description = do_shortcode($description);
  345.  
  346.         $append = "";
  347.         $prepend = "";
  348.        
  349.         if($depth==0 && $menu_style!="2")
  350.         {
  351.             $description = $append = $prepend = "";
  352.         }
  353.         $locations = get_theme_mod('nav_menu_locations');
  354.        
  355.         if($locations['primary']) {
  356.             $item_output = "";
  357.             $item_output = $args->before;
  358.             $item_output .= '<a'. $attributes .'>';
  359.             $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;
  360.             $item_output .= '</a>';
  361.             $item_output .= $description.$args->link_after;
  362.             $item_output .= $args->after;
  363.             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth = 0, $args, $args, $current_object_id = 0 );
  364.         }
  365.     }
  366. }
  367. function anps_custom_colors() {
  368.     echo '<style type="text/css">
  369.        #gallery_images .image {width: 23%;margin:0 1%;float: left}
  370.        #gallery_images ul:after {content: "";display: table;clear: both;}
  371.        #gallery_images .image img {max-width: 100%;height: 50px;}
  372.    </style>';
  373. }
  374. add_action('admin_head', 'anps_custom_colors');
  375. /* Post/Page gallery images */
  376. include_once 'anps-framework/gallery_images.php';
  377. function anps_scripts_and_styles() {
  378.     wp_enqueue_script("jquery");
  379.     wp_enqueue_style("custom_styles", get_template_directory_uri()  . "/includes/custom-styles.php");
  380.     wp_enqueue_style("prettyphoto", get_template_directory_uri()  . "/css/prettyPhoto.css");
  381.     wp_enqueue_style("font-awesome", "//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
  382.  
  383.     global $is_IE;
  384.  
  385.     if ( $is_IE ) {
  386.         wp_enqueue_style("ie-fix", get_template_directory_uri() . '/css/ie-fix.css');
  387.         wp_enqueue_script( "iefix", get_template_directory_uri()  . "/js/ie-fix.js", '', '', true );
  388.     }
  389.  
  390.     wp_register_script( "fullwidth-slider", get_template_directory_uri()  . "/js/fullwidth-slider.js", '', '', true );
  391.     if( ! isset( $_GET['vceditor'] ) ) {
  392.         wp_deregister_script( 'isotope' );
  393.         wp_enqueue_script( "anps-isotope", get_template_directory_uri()  . "/js/jquery.isotope.min.js", '', '', true );
  394.     }
  395.     wp_enqueue_script( "smoothscroll", get_template_directory_uri()  . "/js/smoothscroll.js", '', '', true );
  396.     wp_register_script( "alert", get_template_directory_uri()  . "/js/bootstrap/alert.js", '', '', true );
  397.     wp_register_script( "tab", get_template_directory_uri()  . "/js/bootstrap/tab.js", '', '', true );
  398.     wp_register_script( "collapse", get_template_directory_uri()  . "/js/bootstrap/collapse.js", '', '', true );
  399.     wp_enqueue_script( "carousel", get_template_directory_uri()  . "/js/bootstrap/carousel.js", '', '', true );
  400.     wp_enqueue_script( "transition", get_template_directory_uri()  . "/js/bootstrap/transition.js", '', '', true );
  401.     wp_register_script( "gmap3_link", "http://maps.google.com/maps/api/js?sensor=false", '', '', true );
  402.     wp_register_script( "gmap3", get_template_directory_uri()  . "/js/gmap3.min.js", '', '', true );
  403.     wp_register_script( "countto", get_template_directory_uri()  . "/js/countto.js", '', '', true );
  404.     wp_enqueue_script( "waypoints", get_template_directory_uri()  . "/js/waypoints.js", '', '', true );
  405.     wp_enqueue_script( "prettyphoto", get_template_directory_uri()  . "/js/jquery.prettyPhoto.js", '', '', true );
  406.     wp_enqueue_script( "parallax", get_template_directory_uri()  . "/js/parallax.js", '', '', true );
  407.     wp_enqueue_script( "functions", get_template_directory_uri()  . "/js/functions.js", '', '', true );
  408.     wp_enqueue_script( "imagesloaded", get_template_directory_uri()  . "/js/imagesloaded.js", array('jquery'), '', true );
  409.      wp_enqueue_script( "doubletaptogo", get_template_directory_uri()  . "/js/doubletaptogo.js", array('jquery'), '', true );
  410. }
  411. add_action( 'wp_enqueue_scripts', 'anps_scripts_and_styles' );
  412. function anps_theme_styles() {    
  413.     global $anps_options_data;
  414.    
  415.     if ( get_option('font_source_1') && get_option('font_source_1')=='Google fonts') {
  416.         wp_enqueue_style( "font_type_1",  'http://fonts.googleapis.com/css?family=' . get_option('font_type_1', 'Open+Sans') . ':400italic,400,600,700,300&subset=latin,latin-ext');
  417.     } else {
  418.         wp_enqueue_style( "font_type_1",  'http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600,700,300&subset=latin,latin-ext');      
  419.     }
  420.        
  421.     if ( get_option('font_source_2') && get_option('font_source_2')=='Google fonts') {
  422.         wp_enqueue_style( "font_type_2",  'http://fonts.googleapis.com/css?family=' . get_option('font_type_2', 'Arial') . ':400italic,400,600,700,300&subset=latin,latin-ext');
  423.     }
  424.  
  425.     wp_enqueue_style( "theme_main_style", get_bloginfo( 'stylesheet_url' ) );
  426.     wp_enqueue_style( "theme_wordpress_style", get_template_directory_uri() . "/css/wordpress.css" );
  427.     wp_enqueue_style( "custom", get_template_directory_uri() . '/custom.css' );
  428.     $responsive = "";
  429.     if (isset($anps_options_data['responsive'])) {
  430.         $responsive = $anps_options_data['responsive'];
  431.     }
  432. }
  433.  
  434. load_theme_textdomain( ANPS_TEMPLATE_LANG, get_template_directory() . '/languages' );
  435.  
  436. /* Admin only scripts */
  437.  
  438. function anps_load_custom_wp_admin_scripts($hook) {
  439.     /* Overwrite VC styling */
  440.     wp_enqueue_style( "vc_custom", get_template_directory_uri() . '/css/vc_custom.css' );
  441.     wp_enqueue_style( "font-awesome", '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' );
  442.  
  443.     if( 'appearance_page_theme_options' != $hook ) {
  444.         return;
  445.     }
  446.  
  447.     /* Theme Options Style */
  448.     wp_enqueue_style( "admin-style", get_template_directory_uri() . '/anps-framework/css/admin-style.css' );
  449.     if(!isset($_GET['sub_page']) || $_GET['sub_page'] == "theme_style" || $_GET['sub_page'] == "options")
  450.         wp_enqueue_style( "colorpicker", get_template_directory_uri() . '/anps-framework/css/colorpicker.css' );
  451.     wp_enqueue_script( "jquery_google", "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" );
  452.     if (isset($_GET['sub_page']) && ($_GET['sub_page'] == "options" || $_GET['sub_page'] == "options_page"))
  453.         wp_enqueue_script( "pattern", get_template_directory_uri() . "/anps-framework/js/pattern.js" );
  454.     if(!isset($_GET['sub_page']) || $_GET['sub_page'] == "theme_style" || $_GET['sub_page'] == "options") {
  455.         wp_enqueue_script( "colorpicker_theme", get_template_directory_uri() . "/anps-framework/js/colorpicker.js" );
  456.         wp_enqueue_script( "colorpicker_custom", get_template_directory_uri() . "/anps-framework/js/colorpicker_custom.js" );
  457.     }
  458.     if (isset($_GET['sub_page']) && $_GET['sub_page'] == "contact_form")
  459.         wp_enqueue_script( "contact", get_template_directory_uri() . "/anps-framework/js/contact.js" );
  460.     wp_enqueue_script( "theme-options", get_template_directory_uri() . "/anps-framework/js/theme-options.js" );
  461. }
  462. add_action( 'admin_enqueue_scripts', 'anps_load_custom_wp_admin_scripts' );
  463.  
  464. /* WooCommerce */
  465. if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
  466.     add_theme_support( 'woocommerce' );
  467.     $woo_data = get_plugin_data(ABSPATH . 'wp-content/plugins/woocommerce/woocommerce.php');
  468.     $woo_version = explode(".", $woo_data['Version']);
  469.     /* If version 2.3 or higher load js for quantity +- */
  470.     if(substr($woo_version[1], 0, 1)>=3) {
  471.         wp_enqueue_script("woo_quantity", get_template_directory_uri() . "/js/quantity_woo23.js",array("jquery"), "", true);
  472.     }
  473.     include_once 'anps-framework/woocommerce/functions.php';
  474.     add_filter( 'woocommerce_enqueue_styles', '__return_false' );
  475. }
  476.  
  477. add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
  478. function jk_related_products_args( $args ) {
  479.     global $anps_shop_data;
  480.     if(!isset($anps_shop_data['shop_related_per_page'])||$anps_shop_data['shop_related_per_page']=="") {
  481.         $per_page = 4;
  482.     } else {
  483.         $per_page = $anps_shop_data['shop_related_per_page'];
  484.     }
  485.     $args['posts_per_page'] = $per_page;
  486.     return $args;
  487. }
  488. add_action( 'admin_head', 'admin_css' );
  489.  
  490. function admin_css(){echo '<link rel="stylesheet" type="text/css" href="http://www.easy2work.at/wp-content/themes/altus/css/backend.css">';}
  491. add_action( 'get_header', 'imported_files' );
  492. function imported_files(){
  493. echo '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,600,700">';
  494. echo '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Titillium+Web:400,300,600,700">';
  495. echo '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:400,300,300italic,100,100italic,400italic,500,500italic,700,700italic,900italic,900">';
  496. }
  497. function modify_contact_methods($profile_fields) {
  498.     $profile_fields['uidnumber'] = 'UID-Nummer';    return $profile_fields;}
  499.     add_filter('user_contactmethods', 'modify_contact_methods');
  500.  
  501. //save extra profile fields
  502. add_action( 'personal_options_update', 'save_extra_profile_fields' );
  503. add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );
  504.  
  505. function save_extra_profile_fields( $user_id )
  506. {
  507.     global $user;
  508.  
  509.     $user = wp_get_current_user();
  510.  
  511.     if ( $_POST )   {
  512.  
  513.         update_user_meta( $user->ID, 'uidnumber', sanitize_text_field($_POST['uidnumber']) );
  514.     }
  515. }
  516.  
  517. add_action('show_user_profile', 'show_extra_profile_fields');
  518. add_action('edit_user_profile', 'show_extra_profile_fields');
  519.  
  520. function show_extra_profile_fields( $user )
  521. {
  522.     ?>
  523.         <p class="form-row form-row-wide">
  524.             <label for="uidnumber"><?php _e( 'UID-Nummer', 'woocommerce' ); ?></label>
  525.             <input type="text" class="input-text" name="uidnumber" id="uidnumber" value="<?php echo get_user_meta( $user->ID, 'uidnumber', true ); ?>" />
  526.         </p>
  527.     <?php
  528. }
  529.    
  530. // removes (free) from free shipping methods
  531.  
  532. add_filter( 'woocommerce_cart_shipping_method_full_label', 'remove_free_label', 10, 2 );
  533.  
  534. function remove_free_label($full_label, $method) {
  535. $full_label = str_replace("(Kostenlos)","",$full_label);
  536. return $full_label;
  537. }
  538.  
  539. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement