/
functions.php
126 lines (92 loc) · 4.49 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
#el topbar de wp fuera
add_filter( 'show_admin_bar', '__return_false' );
include_once 'backend/bandas.php';
include_once 'backend/avisos.php';
include_once 'backend/url_opcional.php';
include_once 'functions_ajax.php';
add_theme_support('post-thumbnails');
// estilos
function ol_enqueue_styles() {
global $wp_styles; // Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
wp_register_style( 'wp-style', get_stylesheet_directory_uri() . '/style.css', array(), '', 'all' );
wp_enqueue_style( 'wp-style' );
}
add_action( 'wp_enqueue_scripts', 'ol_enqueue_styles' );
// scripts
function ol_enqueue_scripts() {
wp_enqueue_style( 'slick-css', get_stylesheet_directory_uri() . '/bower_components/slick-carousel/slick/slick.css' );
wp_enqueue_style( 'slick-theme-css', get_stylesheet_directory_uri() . '/bower_components/slick-carousel/slick/slick-theme.css' );
wp_enqueue_style("google-fonts", "https://fonts.googleapis.com/css?family=Permanent+Marker|Special+Elite|Averia+Sans+Libre|Open+Sans");
wp_enqueue_style( 'offlimits-css', get_stylesheet_directory_uri() . '/css/app.css' );
wp_enqueue_script( 'jquery', get_stylesheet_directory_uri() . '/bower_components/jquery/dist/jquery.js',array(),'2', false );
wp_enqueue_script( 'whatinput-js', get_stylesheet_directory_uri() . '/bower_components/what-input/what-input.js',array('jquery'),'0.99', true );
wp_enqueue_script( 'foundation-js', get_stylesheet_directory_uri() . '/bower_components/foundation-sites/dist/foundation.js',array(),'0.99', true );
wp_enqueue_script( 'app-js', get_stylesheet_directory_uri() . '/js/app.js',array('foundation-js') );
wp_enqueue_script( 'img-js', get_stylesheet_directory_uri() . '/bower_components/imgLiquid/js/imgLiquid.js',array(),'0.99', true );
wp_enqueue_script( 'slick-js', get_stylesheet_directory_uri() . '/bower_components/slick-carousel/slick/slick.js',array(),'0.99', true );
wp_enqueue_script( 'front-js', get_stylesheet_directory_uri() . '/js/frontendutils.js',array(),'0.1', true );
wp_enqueue_script( 'offlimits-js', get_stylesheet_directory_uri() . '/js/offlimits.js',array('jquery'),'0.01', true );
wp_localize_script( 'offlimits-js', 'ol_ajax',
array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
)
);
if( is_page("Inicio") )
wp_enqueue_script( 'tiempo_faltante', get_stylesheet_directory_uri() . '/js/tiempo_faltante.js',array('offlimits-js'),'0.01', true );
// para el mapa cambiar api key
wp_enqueue_script( 'maps-js', 'https://maps.googleapis.com/maps/api/js', array(), '1', false );
wp_enqueue_script( 'maps-js', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBpQxyk-9VglJzuX10s8PFkufhjRPpsqy8&callback=initMap', array(), '1', true );
//
if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'ol_enqueue_scripts' );
// Menú
function add_classes_on_li($classes, $item, $args) {
$classes[] = 'small-12 large-3 columns end color_principal uppercase fontL font2 text-center p2';
return $classes;
}
add_filter('nav_menu_css_class','add_classes_on_li',1,3);
function registrar_menus() {
register_nav_menu('menu-principal',__( 'Menú principal' ));
}
add_action( 'init', 'registrar_menus' );
add_action( 'init', 'add_excerpts_to_pages' );
function add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
function obtener_link($ID) {
$url_opcional = get_post_meta( $ID, 'link-opcional', true );
if( ! $url_opcional )
$url = get_the_permalink( $ID );
else
$url = $url_opcional;
if ( strpos( $url, 'http://' ) !== false ) {
$target_blank = ' target="blank"';
} else {
$target_blank = 0;
$url = site_url() . "/" . $url;
}
return $url;
}
// woocommerce supoprt
// remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
// remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
//
//
// add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
// add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
//
// function my_theme_wrapper_start() {
// echo '<section id="main">';
// }
//
// function my_theme_wrapper_end() {
// echo '</section>';
// }
add_action( 'init', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' ); }
add_filter('woocommerce_enable_order_notes_field', '__return_false');