Skip to content

Instantly share code, notes, and snippets.

View jocastaneda's full-sized avatar

Jose Castaneda jocastaneda

View GitHub Profile
@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
*/
<?php
add_filter( 'shortcode_atts_gallery', 'medium_size' );
function medium_size( $attr ){
$attr['size'] = 'medium';
return $attr;
}
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 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' ),
<?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
/*
Plugin Name: Kalunder
Plugin URI: http://blog.josemcastaneda.comn
Description: Adds the shortcode kalunder so that you can display the WordPress calendar to any post, page or custom post type.
Author: Jose Castaneda
Version: 1.0.0
Author URI: https://blog.josemcastaneda.com
*/
add_shortcode( 'kalunder', 'jc_get_cal' );
<?php
function lametheme_get_breadcrumbs() {
/* === OPTIONS === */
$text['home'] = esc_html__( 'Home', 'lametheme' ); // text for the 'Home' link
$text['blog'] = esc_html__( 'Blog', 'lametheme' ); // text for the 'Blog' link
$text['category'] = esc_html__( 'Archive by Category "%s"', 'lametheme' ); // text for a category page
$text['search'] = esc_html__( 'Search Results for "%s" Query', 'lametheme' ); // text for a search results page
$text['tag'] = esc_html__( 'Posts Tagged "%s"', 'lametheme' ); // text for a tag page
$text['author'] = esc_html__( 'Articles Posted by %s', 'lametheme' ); // text for an author page
@jocastaneda
jocastaneda / audio.css
Last active January 27, 2018 16:28
HTML and CSS provided when using [audio|video] shortcodes in WordPress. The CSS was extracted and any pre-populated styles are inline-styles that are used by MediaElements. Note that you can target specific instances by targetting the `#mep_{$instance}` or even `#{$type}-{$post_id}-{$instance}` Yes, I have provided some SCSS as well if you want …
#mep_0 {
width: 100%;
height: 30px;
}
#audio-post_id-1 {
width: 100%;
}
.mejs-offscreen {
@jocastaneda
jocastaneda / questions.md
Created June 20, 2018 18:25
Health Check contributing questions
  • is a local setup needed?
    • how does one setup for contributing?
  • creating issues in the github repo?
    • follow a template or just open an issue?
  • what is a good pull request?
    • is up to date with current master of the project?
    • commit messages clean?
    • PHPCS standards followed?
    • should branches be used?
  • should branch names be descriptive?
diff --git a/src/includes/class-healthcheck.php b/src/includes/class-healthcheck.php
index ff3f4ad..31204fb 100644
--- a/src/includes/class-healthcheck.php
+++ b/src/includes/class-healthcheck.php
@@ -308,13 +308,16 @@ class HealthCheck {
</h1>
<?php
- $tabs = array(
+ /*