Skip to content

Instantly share code, notes, and snippets.

@zenman
zenman / touch_scrollable_function.css
Created October 1, 2012 20:44
Touch Scrollable Image Area WP Widget
/* set default styles for draggable area */
.drag-mask {
float: left;
width: 100%;
height: 120px;
overflow: hidden;
}
.drag-container {
width: 2000px;
}
@zenman
zenman / snippet.php
Last active October 2, 2018 11:55
Archives by Category
<?php
/*
Plugin Name: Archives for a category
Plugin URI: http://kwebble.com/blog/2007_08_15/archives_for_a_category
Description: Adds a cat parameter to wp_get_archives() to limit the posts used to generate the archive links to one or more categories.
Author: Rob Schlüter
Author URI: http://kwebble.com/
Version: 1.4b
Copyright
@zenman
zenman / permalink.htaccess
Created October 30, 2012 21:59
Standard Permalink Structure for Wordpress
@zenman
zenman / snippet.css
Created November 5, 2012 16:24
Flexslider font flash fix
-webkit-font-smoothing: antialiased !important;
@zenman
zenman / snippet.php
Last active December 10, 2015 19:28
Remove empty <p> tags from the_content() input
<?php
/*
* Remove empty <p> tags from the_content() input
*
*/
add_filter('the_content', 'remove_empty_p', 20, 1);
function remove_empty_p($content){
$content = force_balance_tags($content);
return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}
@zenman
zenman / snippet.php
Created January 8, 2013 04:07 — forked from tcmulder/wp-old-content-debugger.php
Set up faux the_content() simulation
<?php
/**
* Set up faux the_content() simulation
*
* You can use this to simulate the_content() through a shortcode. Simply
* add the shortcode [faux] on any page in wp-admin and publish. Then,
* Then, make all your changes in your favorite text editor in the includes/faux-content.php
* file. Once finished, paste the contents of includes/faux-content.php into the page in wp-admin.
*/
function faux_the_content_() {
@zenman
zenman / snippet.php
Created January 8, 2013 04:12
Add div section within the_content() as a short code
<?php
/*
* Add div section within the content as a short code.
*
* This allows users to edit content in visual mode without stripping
* out necessary but hidden <div> tags.
*
* Example usages:
* [section]My Content[/section] = <div>My Content</div>
* [section width='6']My Content[/section] = <div class="col6">My Content</div>
@zenman
zenman / snippet.php
Created January 11, 2013 22:39
Enqueue your own version of jquery for WordPress.
<?php
/* This can go right above wp_head(); in header.php */
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://code.jquery.com/jquery-1.7.1.min.js');
wp_enqueue_script('jquery');
@zenman
zenman / snippet.php
Created March 7, 2013 18:41
Modify default query_posts.
<?php
//get the defualt query.
global $query_string;
//use the defualt query, but add your modifications connected by &.
query_posts($query_string . '&your_mods=awesome');
?>
@zenman
zenman / snippet.php
Last active December 16, 2015 03:49
Conditional Google Analytics code.
<?php
//hostname based google code, only run if on live site - By Tom Horak, modified by Tomas Mulder.
//placed right before closing head tag according to google best practice: https://support.google.com/analytics/answer/1008080?hl=en
$hostname = $_SERVER['HTTP_HOST']; //dev.zenman.com | localhost | Live server | etc..
switch ($hostname) {
case 'localhost': //do nothing
//echo '<!-- no google analytics code -->';
break;
case 'localhost:8888': //do nothing