/
functions.php
207 lines (200 loc) · 8.78 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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
// CICOM custom
function cicom_scripts() {
$parent_style = 'parent-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'custom-child', get_stylesheet_directory_uri() . '/assets/css/cicom.css', array($parent_style), '1.0.0' );
wp_enqueue_script('img-script',get_stylesheet_directory_uri() . '/assets/js/imgLiquid-min.js', array( 'jquery' ));
wp_enqueue_script('custom-script',get_stylesheet_directory_uri() . '/assets/js/cicom.js', array( 'jquery' ));
}
add_action( 'wp_enqueue_scripts', 'cicom_scripts' );
//
function custom_excerpt($length) {
return 24;
}
add_filter('excerpt_length','custom_excerpt',999);
// Custom posts
function cicom_asoc_menu() {
// etiquetas backend
$labels = array(
'name' => _x( 'Menú CICOM', 'Post Type General Name', 'cicom-theme' ),
'singular_name' => _x( 'Menu Top CICOM', 'Post Type Singular Name', 'cicom-theme' ),
'menu_name' => __( 'Menú CICOM Top', 'cicom-theme' ),
'parent_item_colon' => __( 'Menu Top padre', 'cicom-theme' ),
'all_items' => __( 'Todos los Menú', 'cicom-theme' ),
'view_item' => __( 'Ver Menu Top', 'cicom-theme' ),
'add_new_item' => __( 'Agrega Menu Top', 'cicom-theme' ),
'add_new' => __( 'Nuevo Menu Top', 'cicom-theme' ),
'edit_item' => __( 'Edita Menu Top', 'cicom-theme' ),
'update_item' => __( 'Actualiza Menu Top', 'cicom-theme' ),
'search_items' => __( 'Busca Menú', 'cicom-theme' ),
'not_found' => __( 'No existen Menú', 'cicom-theme' ),
'not_found_in_trash' => __( 'No existen Menú en la basura', 'cicom-theme' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => __( 'CICOM Menú', 'cicom-theme' ),
'description' => __( 'Menú para mostrar asociados', 'cicom-theme' ),
'labels' => $labels,
'supports' => array('title', 'custom-fields'),
'menu_icon' => 'dashicons-images-alt',
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'taxonomies' => ''
);
// Registra
register_post_type( 'cicom_asoc_menu', $args );
}
// banners footer
function cicom_banners_footer() {
// etiquetas backend
$labels = array(
'name' => _x( 'Banners CICOM', 'Post Type General Name', 'cicom-theme' ),
'singular_name' => _x( 'Banner CICOM', 'Post Type Singular Name', 'cicom-theme' ),
'menu_name' => __( 'Banners CICOM Footer', 'cicom-theme' ),
'parent_item_colon' => __( 'Banner padre', 'cicom-theme' ),
'all_items' => __( 'Todos los Banners', 'cicom-theme' ),
'view_item' => __( 'Ver Banner', 'cicom-theme' ),
'add_new_item' => __( 'Agrega Banner', 'cicom-theme' ),
'add_new' => __( 'Nuevo Banner', 'cicom-theme' ),
'edit_item' => __( 'Edita Banner', 'cicom-theme' ),
'update_item' => __( 'Actualiza Banner', 'cicom-theme' ),
'search_items' => __( 'Busca Banners', 'cicom-theme' ),
'not_found' => __( 'No existen Banners', 'cicom-theme' ),
'not_found_in_trash' => __( 'No existen Banners en la basura', 'cicom-theme' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => __( 'CICOM Banners', 'cicom-theme' ),
'description' => __( 'Banners para CICOM', 'cicom-theme' ),
'labels' => $labels,
'supports' => array('title','custom-fields'),
'menu_icon' => 'dashicons-images-alt',
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 6,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'taxonomies' => '',
);
// Registra
register_post_type( 'cicom-banners-footer', $args );
}
// socios landing page
function socios_landing_page() {
// etiquetas backend
$labels = array(
'name' => _x( 'Socios CICOM', 'Post Type General Name', 'cicom-theme' ),
'singular_name' => _x( 'Socio CICOM', 'Post Type Singular Name', 'cicom-theme' ),
'menu_name' => __( 'Socios CICOM', 'cicom-theme' ),
'parent_item_colon' => __( 'Socio padre', 'cicom-theme' ),
'all_items' => __( 'Todos los Socios', 'cicom-theme' ),
'view_item' => __( 'Ver Socio', 'cicom-theme' ),
'add_new_item' => __( 'Agrega Socio', 'cicom-theme' ),
'add_new' => __( 'Nuevo Socio', 'cicom-theme' ),
'edit_item' => __( 'Edita Socio', 'cicom-theme' ),
'update_item' => __( 'Actualiza Socio', 'cicom-theme' ),
'search_items' => __( 'Busca Socios', 'cicom-theme' ),
'not_found' => __( 'No existen Socios', 'cicom-theme' ),
'not_found_in_trash' => __( 'No existen Socios en la basura', 'cicom-theme' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => __( 'CICOM Socios', 'cicom-theme' ),
'description' => __( 'Landing Page para Socios CICOM', 'cicom-theme' ),
'labels' => $labels,
'supports' => array('title', 'excerpt','thumbnail', 'custom-fields'),
'menu_icon' => 'dashicons-admin-users',
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 4,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'taxonomies' => ''
);
// Registra
register_post_type( 'socios-cicom', $args );
}
function eventos_cicom() {
// etiquetas backend
$labels = array(
'name' => _x( 'Eventos CICOM', 'Post Type General Name', 'cicom-theme' ),
'singular_name' => _x( 'Evento CICOM', 'Post Type Singular Name', 'cicom-theme' ),
'menu_name' => __( 'Eventos CICOM', 'cicom-theme' ),
'parent_item_colon' => __( 'Evento padre', 'cicom-theme' ),
'all_items' => __( 'Todos los Eventos', 'cicom-theme' ),
'view_item' => __( 'Ver Evento', 'cicom-theme' ),
'add_new_item' => __( 'Agrega Evento', 'cicom-theme' ),
'add_new' => __( 'Nuevo Evento', 'cicom-theme' ),
'edit_item' => __( 'Edita Evento', 'cicom-theme' ),
'update_item' => __( 'Actualiza Evento', 'cicom-theme' ),
'search_items' => __( 'Busca Eventos', 'cicom-theme' ),
'not_found' => __( 'No existen Eventos', 'cicom-theme' ),
'not_found_in_trash' => __( 'No existen eventos en la basura', 'cicom-theme' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => __( 'CICOM Eventos', 'cicom-theme' ),
'description' => __( 'CPT para Eventos de CICOM', 'cicom-theme' ),
'labels' => $labels,
'supports' => array('title', 'thumbnail', 'custom-fields'),
'menu_icon' => 'dashicons-media-document',
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'taxonomies' => ''
);
// Registra
register_post_type( 'eventos-cicom', $args );
}
// inicia CPTs
add_action('init', 'socios_landing_page', 0);
add_action('init', 'cicom_asoc_menu', 0);
add_action('init', 'cicom_banners_footer', 0);
add_action('init', 'eventos_cicom', 0);
// cpt a categorias
add_action( 'init', 'add_category_taxonomy_to_cpt' );
function add_category_taxonomy_to_cpt() {
register_taxonomy_for_object_type( 'category', 'socios-cicom' );
register_taxonomy_for_object_type( 'category', 'cicom-banners-footer' );
}
// analytics
add_action('wp_head', 'add_analytics');
function add_analytics() { ?>
<!-- <script>
</script> -->
<?php
}