Skip to content

Instantly share code, notes, and snippets.

View jocastaneda's full-sized avatar

Jose Castaneda jocastaneda

View GitHub Profile
<?php
function jc_get_styles(){
$styles = array();
$styles[0]["text"]='<span class="white">Black text on white </span>';
$styles[0]["title"]='Click here to set Style 0';
$styles[0]["sheet"]='style/white';
$styles[1]["text"]='<span class="black">White text on black </span>';
<?php if ( is_search() || is_front_page() ) : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
add_action( 'customize_register', 'slug_customizer' );
function slug_customizer( $customizer ){
$sliders = array();
if ( class_exists( 'Soliloquy_Lite' ) || class_exists( 'Soliloquy' ) )
$sliders['soliloquy'] = 'Soliloquy';
if ( class_exists( 'MetaSliderPlugin' ) )
$sliders['metaslider'] = 'Meta Slider';
<?php
add_filter( 'shortcode_atts_gallery', 'medium_size' );
function medium_size( $attr ){
$attr['size'] = 'medium';
return $attr;
}
@jocastaneda
jocastaneda / gist:9631636
Created March 18, 2014 23:00
Count how many galleries the post has and count all the images. Does require WP 3.6+
<?php
// Get all the galleries in the current post
$galleries = get_post_galleries( get_the_ID(), false );
// Count all the galleries
$total_gal = count( $galleries );
/**
* count all the images
* @param array $array The array needed
* @return int returns the number of images in the post
*/