Skip to content

Instantly share code, notes, and snippets.

View richerimage's full-sized avatar

Richard Barratt richerimage

View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@Dimasmagadan
Dimasmagadan / WP_Query.php
Last active November 21, 2022 06:27 — forked from luetkemj/wp-query-ref.php
#WordPress query with args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.
@dmtintner
dmtintner / faculty_meta.php
Created June 19, 2012 15:03
WPAlchemy Multiple Wordpress TinyMCE editors using wp_editor
<p>
<label>Publications</label>
<?php
$mb->the_field('publications');
$val = html_entity_decode($mb->get_the_value());
$id = $mb->get_the_name();
$settings = array(
'textarea_rows' => 6,
'quicktags' => array(
@awshout
awshout / foundation3-navbar-menu.php
Last active October 13, 2021 17:07
WordPress Menu & Walker for ZURB's Foundation 3 Nav Bar
<?php
add_theme_support('menus');
/*
http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus( array(
'main-menu' => 'Main Menu' // registers the menu in the WordPress admin menu editor
) );
@spivurno
spivurno / gist:3710890
Created September 13, 2012 00:03
Gravity Wiz // Set Post Status by Field Value
/**
* Set Post Status by Field Value
* http://gravitywiz.com/2012/05/04/set-post-status-by-field-value/
*/
// update "3" to the ID of your form
add_filter('gform_post_data_3', 'gform_dynamic_post_status', 10, 3);
function gform_dynamic_post_status($post_data, $form, $entry) {
// update "5" to the ID of your custom post status field
@malarkey
malarkey / Contract Killer 3.md
Last active May 17, 2024 15:28
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@roborourke
roborourke / add_feed.php
Last active April 11, 2022 22:47
add_feed() example for WordPress
<?php
class custom_feed {
public $feed = 'custom-xml';
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
anonymous
anonymous / index.html
Created June 15, 2013 15:41
A CodePen by Kyle Foster. Ken Burns Banner - A subtle, classy Ken Burns effect applied on page load to some banners I've been working on. Let me know what you think. Note: I applied the background to a :before pseudo-element. For better browser support, just use an empty span or div.
<!-- Header -->
<header class="banner">
<h1>Ken Burns Banner</h1>
</header>
<!-- Other stuff -->
<main>
<article>
<h1>Article</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut enim lorem. Aenean consectetur magna quam, ac pharetra velit molestie vitae. Donec eros nisi, condimentum in nunc eget, rutrum faucibus orci. Aenean lacinia augue vel blandit ultricies. Quisque aliquet dui egestas consectetur aliquet. Etiam semper interdum sodales. Donec vehicula arcu rutrum nisi malesuada tincidunt convallis vitae magna. Nam in tortor commodo, molestie ligula vitae, volutpat justo.</p>
<?php
add_filter( 'default_content', 'add_default_content' );
function add_default_content( $content ) {
global $post_type;
switch ( $post_type ) {
case 'post':
$content = "<p>This will be the first paragraph of all new BLOGPOSTS. I am adding a default paragraph. You can add any HTML code or text.</p>";
break;
case 'page':
$content = "<p>This will be the first paragraph of all new PAGES. I am adding a default paragraph. You can add any HTML code or text.</p>";
add_action('media_buttons','add_sc_select',11);
function add_sc_select(){
global $shortcode_tags;
/* ------------------------------------- */
/* enter names of shortcode to exclude bellow */
/* ------------------------------------- */
$exclude = array("wp_caption", "embed");
echo '&nbsp;<select id="sc_select"><option>Shortcode</option>';
foreach ($shortcode_tags as $key => $val){
if(!in_array($key,$exclude)){