Skip to content

Instantly share code, notes, and snippets.

Mannie Schumpert mannieschumpert

Block or report user

Report or block mannieschumpert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View siteground-composer.md

How to get Composer running on SiteGround shared

  1. Download getcomposer.org/composer.phar to your account's home directory — /home/username.
  2. Edit .bashrc file in same directory by adding alias composer='/usr/local/php56/bin/php-cli ~/composer.phar' line. Update php56 part to current relevant version, if necessary.
  3. Restart SSH session or run source ~/.bashrc to reload config.
  4. Use composer command!
@richardW8k
richardW8k / button_filters.php
Last active Jul 14, 2016
convert the next, previous and/or submit button <input> to <button> and uses the input value to create the button text inside a <span>, this means you can set the button text by editing the form or page break settings.
View button_filters.php
<?php
/**
* Filters the next, previous and submit buttons.
* Replaces the forms <input> buttons with <button> while maintaining attributes from original <input>.
* @param string $button Contains the <input> tag to be filtered.
* @param object $form Contains all the properties of the current form.
* @return string The filtered button.
*/
add_filter( 'gform_next_button', 'input_to_button', 10, 2 );
add_filter( 'gform_previous_button', 'input_to_button', 10, 2 );
@trepmal
trepmal / no-whitespace-nav.php
Created Jan 3, 2014
(WordPress snippet) Gets rid of the whitespace between "</li> <li>" in custom nav menus. Why? The whitespace can cause stupid headaches when the li's have `display: inline-block;`
View no-whitespace-nav.php
<?php
// note the walker param
wp_nav_menu( array(
'walker' => new No_WhiteSpace_Nav_Menu,
'theme_location' => 'primary',
'menu_class' => 'nav-menu'
) );
// in your theme's functions.php
@pbearne
pbearne / gist:7221162
Created Oct 29, 2013
how to add a tax_query to pre_get_posts in wordpress
View gist:7221162
add_action( 'pre_get_posts', array( $this,'function_pre_get_posts' ) );
function function_pre_get_posts(){
// you can't use the query->set here for tax_query
// as tax query has already been made
// so you need to need add youself to any
// existing tax query
$tax_query = array(
'taxonomy' => 'tax_name',
View disable-strict.php
<?php
// Disables sticky Strict Standards warnings. Good for poorly developed plugins.
// Put this file in mu-plugins
if ( WP_DEBUG ) {
error_reporting( E_ALL & ~E_STRICT );
}
View shell.md
@danielbachhuber
danielbachhuber / gist:3258825
Created Aug 4, 2012
Quick way to handle redirects for old pages
View gist:3258825
<?php
/**
* Quick way to handle redirects for old pages
*
* From Happiness Bar at WordCamp SF 2012
*/
add_action( 'init', 'mea_redirects' );
function mea_redirects() {
$mea_redirects = array(
// Enter your old URI => new URI
@c3mdigital
c3mdigital / multiple-post-query.php
Created May 11, 2012
Custom $wp_query loop to show 3 posts from 3 different post types using only 1 query
View multiple-post-query.php
<?php
$args = array(
'post_type' => array( 'type1', 'type2', 'type3' ),
'posts_per_page' => -1
);
$myquery = new WP_Query( $args );
$type1 = 0; $type2 = 0; $type3 = 0; $count = 0;
while ( $myquery->have_posts() ) : $myquery->the_post();
@hmfs
hmfs / gist:2287412
Created Apr 2, 2012 — forked from luetkemj/wp-query-ref.php
WordPress: WP_Query $args Ultimate Reference
View gist:2287412
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
View Move Wordpress.sql
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');
You can’t perform that action at this time.