This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'dolly_load_styles' ); | |
function dolly_load_styles() { | |
$css_url = add_query_arg( 'dolly-styles', 'true', home_url() ); | |
wp_enqueue_style( 'dolly-styles', $css_url ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'plugins_loaded', 'dolly_generate_css_file' ); | |
function dolly_generate_css_file() { | |
if ( isset( $_GET['dolly-styles'] ) && $_GET['dolly-styles'] === 'true' ) { | |
// "Engañar la cabecera" | |
// Generar aquí el CSS | |
exit; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'plugins_loaded', 'dolly_generate_css_file' ); | |
function dolly_generate_css_file() { | |
if ( isset( $_GET['dolly-styles'] ) && $_GET['dolly-styles'] === 'true' ) { | |
header( 'Content-type: text/css' ); | |
$options = get_option( 'dolly-options' ); | |
?> | |
.mi-clase { | |
background:<?php echo $options['background-color']; ?>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
window.CalendarPlusAdmin = { | |
models: {}, | |
views: {}, | |
collections: {}, | |
/*****************************************************************/ | |
/** HELPERS **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// extend the Function object to include a wrap instance method | |
Function.prototype.wrap = function( callback ) { | |
var original = this; | |
// Aquí arguments tiene un sólo elemento (la función anónima que se pasa a speak) | |
console.log(arguments); | |
return function() { | |
// Aquí arguments tiene 23 elementos (¿Por qué?). Son 'Mary' y 'Kate' | |
// Si estamos en una función anónima sin parámetros,¿No debería estar vacío? | |
console.log(arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function media_files_tools_load_js(){ | |
wp_enqueue_media(); | |
wp_enqueue_script('media_files_tools_load_js' , "/" . PLUGINDIR . '/media-files-tools/js/uploader.js' , array('jquery'),'2.0'); | |
$object = array( | |
'conti' => __( 'John Conti', 'conti' ), | |
'my_string' => __( 'My String', 'conti' ) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Esto es lo que crea wp_localize_script ( no lo tienes que poner en tu fichero): | |
media_files_i18n = { | |
conti: 'John Conti', // O su versión traducida, si la hay | |
my_string: 'My String' // O su versión traducida, si la hay | |
}; | |
// Y ahora, dentrode uploader.js, simplemente puedes usar: | |
var my_name = media_files_i18n.conti |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* En lugar de usaar the_category( ' | ' ), usa alex_the_category( ' | ' ) | |
* Añadee una clase CSS a cada link en la lista. Si tu categoría se llama "Mi Categoría", | |
* la clase será "cat-mi-categoria" | |
* | |
* Si no le metes el parámetro separator, va a salir feo. | |
*/ | |
function alex_the_category( $separator = '' ) { | |
global $wp_rewrite; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'posts-list', 'ignacio_posts_list_shortcode' ); | |
function ignacio_posts_list_shortcode( $atts ) { | |
$defaults = array( | |
'items' => 3 | |
); | |
$atts = wp_parse_args( $atts, $defaults ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BROWSER_PATH='open /Applications/Google\ Chrome.app' | |
if [[ $# -eq 0 ]] ; then | |
echo "Please enter a version number:" | |
read VERSION | |
else | |
VERSION=$1 | |
fi |