This file contains 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
$('a[href*=#]').click(function(){ | |
$('html, body').animate({ | |
scrollTop: $( $.attr(this, 'href') ).offset().top | |
}, 700, 'linear'); | |
return false; | |
}); |
This file contains 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
/* PX to EM conversion | |
example: font-size: em(30); | |
*/ | |
@function em($target, $context: 16) { | |
@return ($target / $context) * 1em; | |
} |
This file contains 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
<div class="entry-content"> | |
<?php the_post_thumbnail(); ?> | |
<?php if (get_custom_field('subtitulo')):?> | |
<p class="evento-subtitulo"><?php print_custom_field('subtitulo'); ?></p> | |
<?php endif;?> | |
<?php if (get_custom_field('fecha_inicio')):?> | |
<p><strong>Fecha:</strong> <?php print_custom_field('fecha_inicio'); ?><?php echo get_custom_field('fecha_fin') ? ' hasta el '.get_custom_field('fecha_fin') :''; ?></p> | |
<?php endif;?> | |
<?php if (get_custom_field('lugar')):?> |
This file contains 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
update_option( 'image_default_link_type', 'none' ); | |
function no_atag_on_images($content){ | |
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); } | |
add_filter('the_content', 'no_atag_on_images'); | |
// From http://freakify.com/make-wordpress-images-non-clickable-inside-a-post/ |
This file contains 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
$(function(){ | |
$(".navtab>li").click(function(){ | |
$(this).addClass('selected').siblings().removeClass('selected'); | |
}); | |
}); | |
// From http://stackoverflow.com/questions/12606784/jquery-add-and-remove-class-on-a-menu |
This file contains 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
$numposts = wp_count_posts('post'); | |
echo $numposts->publish; | |
// From http://wordpress.org/support/topic/get-pount-position-in-total-post-count?replies=5 |
This file contains 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
class MY_Post_Numbers { | |
private $count = 0; | |
private $posts = array(); | |
public function display_count() { | |
$this->init(); // prevent unnecessary queries | |
$id = get_the_ID(); | |
echo sprintf( '<div class="post-counter">Post number<span class="num">%s</span><span class="slash">/</span><span class="total">%s</span></div>', $this->posts[$id], $this->count ); | |
} |
This file contains 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
element.getBoundingClientRect(); // Get position in viewport coordinates | |
// From http://stackoverflow.com/questions/1567327/using-jquery-to-get-elements-position-relative-to-viewport |
This file contains 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
function pa_admin_area_favicon() { | |
echo '<link rel="shortcut icon" href="http://cdn.alex.leonard.ie/favicon.ico" />'; | |
} | |
add_action('admin_head', 'pa_admin_area_favicon'); | |
// From http://alex.leonard.ie/2012/05/24/wordpress-admin-area-favicon/ |
This file contains 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
.second { | |
.first ~ & { | |
/* styles to be applied to .second if a .first exists at the same node level */ | |
} | |
} | |
// From http://stackoverflow.com/questions/15246387/css-and-or-sass-sibling-selector-upwards |
OlderNewer