-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
198 lines (183 loc) · 5.82 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
<?php if ( function_exists('add_theme_support') ) {
add_theme_support('post-thumbnails');
add_image_size('head', 1920, 800, true );
//add_image_size('squared', 1080, 1080, true );
//add_image_size('staff', 384, 600, true );
}
/*
add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
$addsizes = array(
"col-6" => 'Media columna'
);
$newsizes = array_merge($sizes, $addsizes);
return $newsizes;
}
*/
add_post_type_support('page', 'excerpt');
;?>
<?php
if(is_single()){
add_filter( 'show_admin_bar', '__return_false' );
}
?>
<?php
/* Add support for wp_nav_menu() */
function register_my_menu() {
register_nav_menu( 'primary', 'Menú principal');
register_nav_menu( 'secondary', 'Menú footer');
// register_nav_menu( 'third', 'Menú interiores');
}
add_action( 'init', 'register_my_menu' );
?>
<?php
function call_scripts() {
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://code.jquery.com/jquery-1.10.0.min.js');
wp_register_script('core', get_template_directory_uri() . '/js/core.js');
wp_enqueue_script('jquery');
wp_enqueue_script('core');
}
add_action('wp_enqueue_scripts', 'call_scripts');
?>
<?php
//Post type register
add_action('init', 'slides_register');
function slides_register() {
$args = array(
'label' => 'Slides',
'singular_label' => 'Slides',
'public' => true,
'menu_position' => 6,
'_builtin' => false,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'rewrite' => array( 'slug' => 'slides'),
'supports' => array('title', 'editor' , 'excerpt' , 'thumbnail' )
);
register_post_type('slides', $args);
flush_rewrite_rules();
}
add_action('init', 'clientes_register');
function clientes_register() {
$args = array(
'label' => 'Clientes',
'singular_label' => 'Cliente',
'public' => true,
'menu_position' => 5,
'_builtin' => false,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'rewrite' => array( 'slug' => 'clientes'),
'supports' => array('title', 'editor' , 'excerpt' , 'thumbnail' )
);
register_post_type('clientes', $args);
flush_rewrite_rules();
}
?>
<?php //register sidebars
/* register_sidebar(array(
'name' => __( 'Home' ),
'id' => 'home',
'description' => __( 'Widgets en esta área se mostrarán en el home, utlice esta área para agregar la mini encuesta' ),
'before_title' => '<h3>',
'after_title' => '</h3>'
)); */
//add_filter('widget_text', 'do_shortcode');
?>
<?php
function my_custom_login_logo() {
echo '<style type="text/css">
body{ background-color:#3a3a3a;}
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/logo.png) !important;
background-size: 120px;
height: 120px;
margin: 0px auto 0px;
width: 120px;
}
</style>';
}
add_action('login_head', 'my_custom_login_logo');?>
<?php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0";
}
return $count;
}
function setPostViews($postID , $aporte) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
//$count++;
$count;
update_post_meta($postID, $count_key, $count+$aporte);
}
}
?>
<?php
//loads products home
add_action('wp_ajax_countShits', 'countShits');
add_action('wp_ajax_nopriv_countShits', 'countShits');
function countShits(){
$corazones = $_GET['corazones'];
setPostViews( 4 , $corazones );
die();
}
?>
<?php
function SuperAdmin() {
echo '<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">';
//echo '<link href="'.get_bloginfo('template_directory').'/admin/bootstrap.css" rel="stylesheet">';
echo "<link href='http://fonts.googleapis.com/css?family=Open+Sans:700,300,800,400' rel='stylesheet' type='text/css'>";
echo '<style type="text/css">
body{ font-family: Open sans, helvetica neue, helvetica, arial , sans-serif}
.wp-admin #adminmenu, .wp-admin #adminmenuback, .wp-admin #adminmenuwrap{ background-color:#129dd9 !important}
#adminmenu .wp-has-current-submenu .wp-submenu, #adminmenu .wp-has-current-submenu .wp-submenu.sub-open, #adminmenu .wp-has-current-submenu.opensub .wp-submenu, #adminmenu a.wp-has-current-submenu:focus+.wp-submenu, .no-js li.wp-has-current-submenu:hover .wp-submenu{background-color:#2cb3ed !important}
.wp-core-ui .button-primary{background-color:#2cb3ed !important}
</style>';
}
add_action('admin_head', 'SuperAdmin');
?>
<?php
/**
* Disable the emoji's
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );
/**
* Filter function used to remove the tinymce emoji plugin.
*
* @param array $plugins
* @return array Difference betwen the two arrays
*/
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
?>
<?php
//add_filter( 'jpeg_quality', create_function( '', 'return 75;' ) );
?>