Skip to content

Instantly share code, notes, and snippets.

@kadai
Last active July 1, 2017 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadai/b313e77a46c72be6b569bab3e72ff51c to your computer and use it in GitHub Desktop.
Save kadai/b313e77a46c72be6b569bab3e72ff51c to your computer and use it in GitHub Desktop.
Conjunto de código de ejemplo
<?php
add_filter( 'wp_title', 'myfunction_cambiandoimagen' );
?>
<?php
function myfunction_cambiandoimagen($get_image_options){
/* SOLAMENTE LE CAMBIAMOS EL TAMAÑO A LO QUE RECIBAMOS... SI LO HACEMOS! */
$default = 150;
$get_image_options['avatar_size'] = $default;
$get_image_options['width'] = $default;
$get_image_options['height'] = $default;
return $get_image_options;
}
?>
<?php
function myfunction_cambiandoimagen($get_image_options){
$default = 150;
$get_image_options['avatar_size'] = $default;
$get_image_options['width'] = $default;
$get_image_options['height'] = $default;
return $get_image_options;
}
add_filter( 'jetpack_top_posts_widget_image_options', 'myfunction_cambiandoimagen' );
?>
<?php
$dato_transient = get_transient('mytransient_salvada');
/* SOLO LOS ADMINISTRADORES PUEDEN "VER" ESTO */
if (($dato_transient === FALSE) && current_user_can('edit_theme_options')){
add_filter('elfiltro_que_veran_administradores', 'funcion_que_se_llamara');
$dato_transient['ya_se_ejecuto'] = TRUE;
/* HACEMOS QUE EL TRANSIENT EXPIRE EN UN DÍA */
/* SOLO SE EJECUTARÁ UNA VEZ AL DÍA */
set_transient('mytransient_salvada', $dato_transient, DAY_IN_SECONDS);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment