Skip to content

Instantly share code, notes, and snippets.

View misfist's full-sized avatar

P. E. A. Lutz misfist

  • NYC
View GitHub Profile
@jplhomer
jplhomer / disable-comments.sh
Created February 25, 2015 16:38
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...
@cfxd
cfxd / acf_taxonomy_hierarchy.php
Last active February 9, 2017 22:47
Add taxonomy hierarchy (parent and child) matching to Advanced Custom Fields
<?php
function add_child_and_parent_to_acf_taxonomy_choices($choices) {
$tax_choices = array();
foreach($choices as $taxonomy => $c) {
$tax_choices[$taxonomy] = $c;
if($taxonomy != 'all' && is_taxonomy_hierarchical($taxonomy)) {
$tax_choices[$taxonomy.'-tax_parent'] = $c.' (parent)';
$tax_choices[$taxonomy.'-tax_child'] = $c.' (child)';
}
@rliverman
rliverman / tribe_filter-bar_custom_filter
Created August 26, 2014 20:27
Add a custom filter to "The Events Calendar Pro" filter bar plugin based on a taxonomy
<?php
/**
* Adding a custom filter
* A simple copy and paste of the existing Category filter
* Find this new filter in: WP Admin > Events > Settings > Filterbar
* Docs for TribeEventsFilter: http://docs.tri.be/Filter-Bar/class-TribeEventsFilter.html
*/
class TribeEventsFilter_CustomClubs extends TribeEventsFilter {
public $type = 'select';

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!
@matthewpizza
matthewpizza / install-composer.sh
Created February 13, 2014 03:55
Install Composer on Webfaction
cd $HOME
ln -s `which php54` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php54
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@Santel
Santel / functions.php
Last active January 16, 2021 16:49
Remove first image from WordPress post
//* Remove first image from single post
function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_home()){
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');
@danielbachhuber
danielbachhuber / gist:7126249
Last active September 5, 2024 01:44
Include posts from authors in the search results where either their display name or user login matches the query string
<?php
/**
* Include posts from authors in the search results where
* either their display name or user login matches the query string
*
* @author danielbachhuber
*/
add_filter( 'posts_search', 'db_filter_authors_search' );
function db_filter_authors_search( $posts_search ) {
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active April 11, 2025 19:59
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
mkdir -p ~/.ssh
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
@nciske
nciske / co-authors-list.php
Last active April 6, 2019 07:43
List just co-authors with thumbnail
<?php
$args = array( 'post_type' => 'guest-author', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' );
$guest_authors = get_posts( $args );
foreach( $guest_authors as $ga ){
echo '<div class="contributor">';