Skip to content

Instantly share code, notes, and snippets.

@kadai
Last active March 25, 2019 10:05
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/2499ddc6bff7e0907051b4eff19267c1 to your computer and use it in GitHub Desktop.
Save kadai/2499ddc6bff7e0907051b4eff19267c1 to your computer and use it in GitHub Desktop.
<?php
add_action('wp_enqueue_scripts', 'dtorrer_agregarFontAwesome');
function dtorrer_agregarFontAwesome(){
wp_enqueue_script('fontawesome', 'https://use.fontawesome.com/releases/v5.7.2/js/all.js', array(), '5.7.2');
wp_enqueue_style('miestilo', plugin_dir_url( __FILE__ ) . 'estilos/miestilo.css', array('jquery', 'fontawesome'), '1.0.0');
}
?>
<?php
add_action('admin_menu', 'dtorrer_administracionSitioWeb');
function dtorrer_administracionSitioWeb(){
add_submenu_page('edit.php', 'Mi Página', 'Nombre del Menú', 'update_core', 'pagina_prueba', 'funcion_mostrar_html');
}
?>
<?php
do_action( 'wp_enqueue_scripts' );
?>
<?php
add_filter('manage_posts_columns', function( $columnas ){
$columnas['image'] = 'Imagen Destacada';
return $columnas;
});
?>
<?php
$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
?>
<?php
add_action('manage_posts_custom_column', 'dtorrer_agregarColumnaDatos', 10, 2);
function dtorrer_agregarColumnaDatos( $columna, $post_id ){
/* ... hacer algo en la acción con los dos argumentos ... */
}
?>
<?php
class MiClase {
public function __construct(){
add_filter('manage_posts_columns', array($this, 'agregar_columna'));
}
public function agregar_columna( $columnas ){
$columnas['image'] = 'Imagen Destacada';
return $columnas;
}
}
$agregar_filtro = new MiClase();
?>
<?php
add_action('wp_enqueue_scripts', 'dtorrer_agregarFontAwesome', 5);
function dtorrer_agregarFontAwesome(){
wp_enqueue_script('fontawesome', 'https://use.fontawesome.com/releases/v5.7.2/js/all.js', array(), '5.7.2');
wp_enqueue_style('miestilo', plugin_dir_url( __FILE__ ) . 'estilos/miestilo.css', array('jquery', 'fontawesome'), '1.0.0');
}
?>
<?php
add_filter('script_loader_src', 'dtorrer_removerQueryString', 15, 1);
add_filter('style_loader_src', 'dtorrer_removerQueryString', 15, 1);
function dtorrer_removerQueryString( $cadena ){
$partes = explode('?ver', $cadena);
return $partes[0];
}
?>
<?php
public static function is_cacheable(){
$ajax_cache = !defined('DOING_AJAX');
$logged_in = (!Swift_Performance_Lite::is_user_logged_in() || Swift_Performance_Lite::check_option('enable-caching-logged-in-users', 1));
$is_404 = (Swift_Performance_Lite::check_option('cache-404',1) || !Swift_Performance_Lite::is_404());
$query_string = (isset($_SERVER['HTTP_X_PREBUILD']) || Swift_Performance_Lite::check_option('ignore-query-string', 1) || empty($_GET));
$post = (isset($_SERVER['HTTP_X_PREBUILD']) || empty($_POST));
$archive = (Swift_Performance_Lite::check_option('exclude-archive',1) && Swift_Performance_Lite::is_archive() ? false : true);
$author = (Swift_Performance_Lite::check_option('exclude-author',1) && Swift_Performance_Lite::is_author() ? false : true);
$rest = (Swift_Performance_Lite::check_option('exclude-rest',1) && Swift_Performance_Lite::is_rest() ? false : true);
$feed = (Swift_Performance_Lite::check_option('exclude-feed',1) && Swift_Performance_Lite::is_feed() ? false : true);
return apply_filters('swift_performance_is_cacheable', !self::is_exluded() && $archive && $author && $rest && $feed && $is_404 && !Swift_Performance_Lite::is_admin() && $post && $query_string && $logged_in && $ajax_cache && !self::is_crawler() && !Swift_Performance_Lite::is_password_protected());
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment