Skip to content

Instantly share code, notes, and snippets.

View lonchbox's full-sized avatar
😎

Pancho lonchbox

😎
View GitHub Profile
@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
*/
@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');
@eteubert
eteubert / functions-login.php
Created November 7, 2011 13:06
WordPress: Activation Email Customization
<?php
function change_welcome_mail_loginlink( $welcome_email, $user_id, $password, $meta ) {
$welcome_email = str_replace( 'LOGINLINK', 'http://www.mysite.com/my/custom/login/url', $welcome_email );
return $welcome_email;
}
add_filter( 'update_welcome_user_email', 'change_welcome_mail_loginlink', 10, 4 );
@mikejolley
mikejolley / template-print-processing-orders.php
Created November 4, 2011 12:45
WooCommerce - Print Processing orders. A template page snippet to (if you are logged in as admin) output all of your orders with 'processing' status (paid) ready for printing.
<?php
/*
Template Name: Print Processing Orders :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@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') );
@wesbos
wesbos / is_blog.php
Created September 2, 2011 19:32
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>