Skip to content

Instantly share code, notes, and snippets.

View lonchbox's full-sized avatar
😎

Pancho lonchbox

😎
View GitHub Profile
<?php function add_video_suffix( $title, $id = null ) {
if( in_the_loop() && in_category( 'Videos', $id ) ) {
$title .= ' [VIDEO]';
}
return $title;
}
add_filter( 'the_title', 'add_video_suffix' );
@clawfire
clawfire / Move Wordpress.sql
Created November 13, 2011 12:30
Move Wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
@billerickson
billerickson / gist:1444580
Created December 7, 2011 20:49
Using a helper function to determine template and body class
<?php
/**
* Return Archive Section
* @author Bill Erickson
* @link http://www.billerickson.net/code/helper-function-for-template-include-and-body-class/
*
* @param null
* @return string
*/
@ivanmendoza
ivanmendoza / icons.less
Created May 12, 2012 10:17
An approach to manage icons using mixins(LessCSS) and CSS Sprites
/*
*
* Icon index
* by @dic7 (github: ivanmendoza)
*
*/
/*
* SPRITE
* url: ../images/icons.png
<?php
if ( ! function_exists( 'wp_new_user_notification' ) ) :
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
// Return early if no password is set.
if ( empty( $plaintext_pass ) ) {
return;
}
$user = get_userdata( $user_id );
@psflannery
psflannery / remove_jetpack_styles.php
Created December 4, 2013 11:02
Remove Jetpack styles - list of enqueued jetpack stylesheets to remove if necessary. via - http://www.tjkelly.com/blog/remove-wordpress-jetpack-css/
function remove_jetpack_styles(){
wp_deregister_style('AtD_style'); // After the Deadline
wp_deregister_style('jetpack-carousel'); // Carousel
wp_deregister_style('jetpack-slideshow'); // Jetpack Slideshow
wp_deregister_style('grunion.css'); // Grunion contact form
wp_deregister_style('the-neverending-homepage'); // Infinite Scroll
wp_deregister_style('infinity-twentyten'); // Infinite Scroll - Twentyten Theme
wp_deregister_style('infinity-twentyeleven'); // Infinite Scroll - Twentyeleven Theme
wp_deregister_style('infinity-twentytwelve'); // Infinite Scroll - Twentytwelve Theme
wp_deregister_style('noticons'); // Notes
@jeherve
jeherve / plugin.php
Last active May 14, 2016 00:59
[Jetpack] Remove all CSS.
<?php
// First, make sure Jetpack doesn't concatenate all its CSS
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
// Then, remove each CSS file, one at a time
// You probably won't need them all, unless you use all the modules, and all the themes! :)
// Some of these are also only loaded on specific admin pages, so it wouldn't affect your readers
function jeherve_remove_all_jp_css() {
wp_deregister_style( 'AtD_style' ); // After the Deadline
@tmayr
tmayr / gist:5190565
Created March 18, 2013 20:34
Foundation Topbar IE8 Fix
.lt-ie9 .top-bar {
background: #2f2f2f;
*zoom: 1;
overflow: visible;
}
.lt-ie9 .top-bar:before, .lt-ie9 .top-bar:after {
content: " ";
display: table;
}
.lt-ie9 .top-bar:after { clear: both; }
@dan-westall
dan-westall / wp_get_object_terms_exclude_filter.php
Last active August 9, 2017 01:23
Allowing wp_get_object_terms to exclude terms with a filter.
<?php
///////Example usage//////////
//get object terms for $post->ID with taxonomies categories and tags,
//args set as fields all and exclude term with id 1
$terms = wp_get_object_terms(
$post->ID,
array(
@matiskay
matiskay / wp-snippets.php
Created September 20, 2011 20:39
Wordpress Snippets
<?php
// http://johnford.is/programmatically-pull-attachments-from-wordpress-posts/
// http://www.wprecipes.com/how-to-show-wordpress-post-attachments
// get all of the images attached to the current post
function _get_images($size = 'thumbnail') {
global $post;
$photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );