Skip to content

Instantly share code, notes, and snippets.

View JLeuze's full-sized avatar

Josh Leuze JLeuze

View GitHub Profile
@JLeuze
JLeuze / jl-random-posts-simple.php
Created February 24, 2012 20:41
Simple plugin for random posts shortcode
<?php /*
Plugin Name: JL Random Posts */
function jl_random_posts() {
$jlrandom_output = '';
$jlrandom_loop = new WP_Query( array( 'posts_per_page' => 3, 'orderby' => 'rand' ) );
while ( $jlrandom_loop->have_posts() ) : $jlrandom_loop->the_post();
$jlrandom_output .= '<li><a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a></li>';
endwhile;
wp_reset_query();
return '<ul>' . $jlrandom_output . '</ul>';
@JLeuze
JLeuze / jl-random-posts.php
Created February 24, 2012 22:39
Plugin for random posts shortcode
<?php
/*
Plugin Name: JL Random Posts
Plugin URI: http://www.jleuze.com/plugins/jl-random-posts/
Description: Load a list of random posts.
Version: 1.0
Author: Josh Leuze
Author URI: http://www.jleuze.com/
License: GPL2
*/
@JLeuze
JLeuze / msp-wp-demo-functionality.php
Created February 24, 2012 23:05
Functionality plugin for MSP WordPress Demo
<?php
/*
Plugin Name: MSP WP Demo Functionality
Plugin URI: https://gist.github.com/1904421
Description: Functionality plugin for MSP WordPress Demo
Version: 1.0
Author: Josh Leuze
Author URI: http://www.jleuze.com/
License: GPL2
*/
@JLeuze
JLeuze / meteor-caption.php
Created May 7, 2012 18:16
Meteor Slides Sample Caption
<div class="meteor-caption">
<h4><?php the_title(); ?></h4>
<?php the_excerpt(); ?>
</div><!-- .meteor-caption -->
@JLeuze
JLeuze / meteor-excerpts.php
Last active October 5, 2015 00:47
Plugin to add excerpts to Meteor Slides
<?php /*
Plugin Name: Meteor Excerpts
Description: Adds excerpts to Meteor Slides.
Author: Josh Leuze
Author URI: http://jleuze.com/
Version: 1.0
*/
function meteorslides_add_excerpt() {
add_post_type_support( 'slide', 'excerpt' );
@JLeuze
JLeuze / replace.js
Created May 19, 2012 18:48
Find and replace WordPress search widget button text with jQuery
jQuery(document).ready(function() {
jQuery('.widget_search').each(function (i) {
jQuery(this).html(jQuery(this).html().replace('value="Search"', 'value="Go"'));
});
});
@JLeuze
JLeuze / remove-meteor-scripts.php
Created May 24, 2012 15:52
Plugin to remove JS and CSS for Meteor Slides when not on homepage
<?php /*
Plugin Name: Remove Meteor Scripts
Description: Remove JS and CSS for Meteor Slides when not needed.
Author: Josh Leuze
Author URI: http://www.jleuze.com/
Version: 1.0 */
add_action( 'template_redirect', 'disable_meteorslides_scripts' );
function disable_meteorslides_scripts() {
@JLeuze
JLeuze / custom_functions_fix.php
Created June 22, 2012 16:15
Queries fix for Flexible theme
<?php
add_action( 'pre_get_posts', 'et_custom_posts_per_page' );
function et_custom_posts_per_page( $query ) {
global $shortname;
if ( is_admin() ) return $query;
if ( $query->is_main_query() && $query->is_category ) {
$query->set( 'posts_per_page', et_get_option( $shortname . '_catnum_posts' ) );
@JLeuze
JLeuze / header.php
Last active February 6, 2016 19:02
Homepage header slideshow for TwentyEleven Theme
<?php
/**
* Header template for the theme
*
* Displays all of the <head> section and everything up till <div id="main">.
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
@JLeuze
JLeuze / meteor-slides-list.php
Created October 6, 2012 20:19
Get a linked list of slide post titles for Meteor Slides
<?php
/* Loop template for the slide posts list */
// Settings for slide list loop
global $post;
$meteor_posttemp = $post;
$meteor_count = 1;
$meteor_loop = new WP_Query( array(