Skip to content

Instantly share code, notes, and snippets.

View cwulff's full-sized avatar

Rev. Christopher Wulff cwulff

  • Vancouver, BC
View GitHub Profile
@dragunoff
dragunoff / simple-password-lockdown-wp.php
Created January 27, 2012 08:13
[WP] Block site from non-logged in users
<?php
/**
* Plugin name: Simple Password lockdown
* Plugin URI: https://gist.github.com/1687747
* Description: Block site from non-logged in users
*/
add_action('get_header', 'wpq_member_only_site');
function wpq_member_only_site() {
anonymous
anonymous / profile.php
Created January 29, 2012 17:10
Wordpress front end log in page template with multiple custom meta_key - input, select, dropdown
<?php
global $user_ID, $user_identity, $user_level;
if ($user_ID) {
if($_POST)
{
@viruthagiri
viruthagiri / functions.php
Created February 15, 2012 18:57
My super duper WordPress functions.php
<?php
/**
* Base functions.php for WordPress themes
*
* @package WordPress 3.3
* @author Andres Hermosilla
*/
/**
@krogsgard
krogsgard / wp-trim-words-example
Created February 23, 2012 05:34
Example query using wp_trim_words()
<div class="info-box">
<?php $krogsquery = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 3
)); ?>
<h3 class="info-headline">City News</h3>
<?php while($krogsquery->have_posts()) : $krogsquery->the_post(); ?>
@jo-snips
jo-snips / event-category-list.php
Created March 12, 2012 03:21
The Events Calendar: List Event Categories
<?php
$terms = get_terms("tribe_events_cat");
$count = count($terms);
if ( $count > 0 ){
echo '<ul class="events-cat-menu">';
foreach ( $terms as $term ) {
echo '<li class="cat_'. $term->slug .'"><a href="'. get_term_link($term->slug, 'tribe_events_cat') .'">' . $term->name . '</a></li>';
}
echo '</ul>';
}
@luetkemj
luetkemj / wp-query-ref.php
Last active September 14, 2024 13:06
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@smeranda
smeranda / facebook_like-box_responsive.css
Created May 1, 2012 20:37
Flexible width layout for Facebook Like Box/Activity Stream to use in Responsive Designs
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@arielsalminen
arielsalminen / endlessPagination.js
Created May 8, 2012 10:08
Custom endless pagination for isotope (supports query strings in url and updates the page count after each load)
jQuery(function () {
var $feed = $(".feed"),
$trigger = $(".next_page"),
$spinner = $(".spinner"),
spinner = "<div class=\"spinner\"></div>";
var isotopeSettings = {
itemSelector: ".box"
}
@retlehs
retlehs / gist:2703644
Created May 15, 2012 17:44
Add a class to widgets in a specific sidebar
<?php
/**
* Add 'class="span4"' to all widgets in the Content Bottom sidebar
*/
function bb_content_bottom_widget_class($params) {
if ($params[0]['id'] == 'roots-content-bottom') {
$class = 'class="span4 ';
$params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1);
}
@kaseybon
kaseybon / mullet-loop.php
Last active September 20, 2019 16:42
Wordpress Mullet Loop: Place this loop in the index.php. Gives the option to pull in a custom content template for the most recent blog post in the blog feed e.g. Show full blog post for most recent post while only showing excerpts for older posts.
<?php if (have_posts()) : ?>
<?php $count = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php $count++; ?>
<!-- Check for the first blog post in the loop && makes sure it the first page of results && makes sure it is the blog -->
<?php if ($count == 1 && $paged == 0 && is_home()) : ?>
<!-- Most recent blog post with custom template will display above older entries - Requires a content-featured.php or whatever you want to name your file or replace with code -->
<?php get_template_part( 'content', 'featured' ); ?>