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
<?php | |
// cf http://stackoverflow.com/questions/14585538/customise-the-wordpress-gallery-html-layout | |
/****** REWRITE THE GALLERIE FUNCTION FROM WORDPRESS **********/ | |
add_shortcode('gallery', 'my_gallery_shortcode'); | |
function my_gallery_shortcode($attr) { | |
$counter=0; | |
//var_dump("Rewrite the shortcode gallery"); |
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
<?php | |
// cf http://shibashake.com/wordpress-theme/how-to-render-your-own-wordpress-photo-gallery | |
function parse_gallery_shortcode($atts) { | |
global $post; | |
if ( ! empty( $atts['ids'] ) ) { | |
// 'ids' is explicitly ordered, unless you specify otherwise. |
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
<?php | |
// cf http://tiffanybbrown.com/2013/02/03/wordpress-adding-custom-galleries-to-your-theme/ | |
remove_shortcode('gallery', 'gallery_shortcode'); | |
add_shortcode('gallery', 'custom_gallery'); | |
function custom_gallery($attr) { | |
$post = get_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
// javascript | |
$.expr[':'].internal = function (obj, index, meta, stack) { | |
// Prepare | |
var | |
$this = $(obj), | |
url = $this.attr('href') || '', | |
isInternalLink; | |
// Check link | |
isInternalLink = url.substring(0, rootUrl.length) === rootUrl || url.indexOf(':') === -1; |
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
<?php | |
$args = array( 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'numberposts' => null, 'post_parent' => $post->ID ); | |
$alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); | |
$image_title = $attachment->post_title; | |
$caption = $attachment->post_excerpt; | |
$description = $image->post_content; | |
$attachments = get_posts($args); | |
if ($attachments) { | |
foreach ( $attachments as $attachment ) { ?> | |
<a href="<?php echo wp_get_attachment_url( $attachment->ID, false ); ?>" rel="lightbox" title="<?php echo $image_title; ?>"><img src="<?php bloginfo('template_url'); ?>/timthumb.php?h=75&w=75&zc=1&src=<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>" alt="" width="75" height="75" border="0" /></a> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>HTML5 Full-Screen Demonstration</title> | |
<style> | |
* | |
{ | |
padding: 0; | |
margin: 0; |
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
<?php | |
// cf http://www.tuxradar.com/practicalphp/11/2/21 | |
function duotone (&$image, $rplus, $gplus, $bplus) { | |
$imagex = imagesx($image); | |
$imagey = imagesy($image); | |
for ($x = 0; $x <$imagex; ++$x) { | |
for ($y = 0; $y <$imagey; ++$y) { |
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
// http://www.dave-bond.com/blog/2010/01/JQuery-ajax-progress-HMTL5/ | |
$.ajax({ | |
xhr: function() | |
{ | |
var xhr = new window.XMLHttpRequest(); | |
//Upload progress | |
xhr.upload.addEventListener("progress", function(evt){ | |
if (evt.lengthComputable) { | |
var percentComplete = evt.loaded / evt.total; |
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
$.xhrPool = []; | |
$.xhrPool.abortAll = function() { | |
$(this).each(function(idx, jqXHR) { | |
jqXHR.abort(); | |
}); | |
$(this).each(function(idx, jqXHR) { | |
var index = $.inArray(jqXHR, $.xhrPool); | |
if (index > -1) { | |
$.xhrPool.splice(index, 1); | |
} |
OlderNewer