Skip to content

Instantly share code, notes, and snippets.

View mannieschumpert's full-sized avatar

Mannie Schumpert mannieschumpert

View GitHub Profile
@benjamincharity
benjamincharity / autonomous.txt
Last active April 12, 2024 22:20
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@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'; } ?>
@pbearne
pbearne / gist:7221162
Created October 29, 2013 19:38
how to add a tax_query to pre_get_posts in wordpress
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',

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 April 29, 2022 18:37
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.
<?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 );
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
<?php
/*
Description: Adds a taxonomy filter in the admin list page for a custom post type.
Written for: http://wordpress.stackexchange.com/posts/582/
By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins
Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps...
*/
add_filter('manage_listing_posts_columns', 'add_businesses_column_to_listing_list');
function add_businesses_column_to_listing_list( $posts_columns ) {
if (!isset($posts_columns['author'])) {
@c3mdigital
c3mdigital / multiple-post-query.php
Created May 11, 2012 22:12
Custom $wp_query loop to show 3 posts from 3 different post types using only 1 query
<?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();
@trepmal
trepmal / no-whitespace-nav.php
Created January 3, 2014 00:14
(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;`
<?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