Repository navigation
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·190 lines (142 loc) · 5.37 KB
/
Copy pathfunctions.php
File metadata and controls
executable file
·190 lines (142 loc) · 5.37 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
// Soporte para títulos
add_theme_support( 'title-tag' );
// Soporte para post thumbnails
add_theme_support( 'post-thumbnails' );
// Iniciamos menú
register_nav_menus( array(
'primary' => __( 'Principal Menu', 'THEMENAME' ),
'legal' => __( 'Legal Menu', 'THEMENAME' ),
) );
// Soporte para widgets
add_action( 'widgets_init', 'theme_slug_widgets_init' );
function theme_slug_widgets_init() {
/* Blog ---------------------- */
register_sidebar( array(
'name' => __( 'Blog', 'theme-slug' ),
'id' => 'sidebar-blog',
'description' => __( 'Widgets disponibles en el blog', 'theme-slug' ),
'before_widget' => '<section id="%1$s" class="widget-blog widget-blog--blog %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget-blog__title">',
'after_title' => '</h4>',
) );
/* Page ---------------------- */
register_sidebar( array(
'name' => __( 'Page', 'theme-slug' ),
'id' => 'sidebar-page',
'description' => __( 'Widgets para páginas', 'theme-slug' ),
'before_widget' => '<section id="%1$s" class="widget widget--name %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget__title">',
'after_title' => '</h4>',
) );
/* Footer ---------------------- */
register_sidebar( array(
'name' => __( 'Footer 1', 'theme-slug' ),
'id' => 'sidebar-footer1',
'description' => __( 'Widgets disponibles en el Footer', 'theme-slug' ),
'before_widget' => '<section id="%1$s" class="widget-footer %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget-footer__title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'theme-slug' ),
'id' => 'sidebar-footer2',
'description' => __( 'Widgets disponibles en el Footer', 'theme-slug' ),
'before_widget' => '<section id="%1$s" class="widget-footer %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget-footer__title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => __( 'Footer 3', 'theme-slug' ),
'id' => 'sidebar-footer3',
'description' => __( 'Widgets disponibles en el Footer', 'theme-slug' ),
'before_widget' => '<section id="%1$s" class="widget-footer %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget-footer__title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => __( 'Footer 4', 'theme-slug' ),
'id' => 'sidebar-footer4',
'description' => __( 'Widgets disponibles en el Footer', 'theme-slug' ),
'before_widget' => '<section id="%1$s" class="widget-footer %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget-footer__title">',
'after_title' => '</h4>',
) );
}
// Soporte para imagenes SVG
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
// Cargarse jQuery de Wordpress
# wp_deregister_script('jquery');
// Woocommerce
// --------------------------------------------------------------------------
// Declare WooCommerce support in third party theme
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
// Borrar boton de añadir a cesta
function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action('init','remove_loop_button');
// Iniciar Woocommerce lightbox
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
// Productos por página
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 20;
return $cols;
}
// Personalizador wordpress
// --------------------------------------------------------------------------
function theme_customize_register( $wp_customize ) {
$wp_customize->add_panel( 'servicios', array(
'title' => __( 'Servicios', 'textdomain' ),
'description' => __( 'Aqui podemos mostrar un mensaje', 'textdomain' ),
'priority' => 160,
'capability' => 'edit_theme_options',
));
$wp_customize->add_section( 'primera_seccion' , array(
'title' => __( 'Primera Seccion', 'textdomain' ),
'panel' => 'servicios',
'priority' => 1,
'capability' => 'edit_theme_options',
));
//Campo de texto
$wp_customize->add_setting( 'campo_texto', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('campo_texto', array(
'label' => __( 'Ejemplo input', 'textdomain' ),
'section' => 'primera_seccion',
'priority' => 1,
'type' => 'text',
));
//Campo textarea
$wp_customize->add_setting( 'campo_textarea', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('campo_textarea', array(
'label' => __( 'Ejemplo textarea', 'textdomain' ),
'section' => 'primera_seccion',
'priority' => 1,
'type' => 'textarea',
));
}
add_action( 'customize_register', 'theme_customize_register' );
?>