Skip to content

Instantly share code, notes, and snippets.

View iHwy's full-sized avatar

Mark Brown iHwy

View GitHub Profile
@iHwy
iHwy / wp-update-plugins-git.sh
Created August 26, 2017 02:33 — forked from markjaquith/wp-update-plugins-git.sh
Update all WordPress plugins using WP-CLI and make a separate git commit for each one
#!/bin/bash
PLUGINS=$(wp plugin list --update=available --field=name | tr -d '\r');
wp plugin update-all;
for plugin in $PLUGINS; do
git add -A "wp-content/plugins/$plugin";
git commit -m "Update plugin: $plugin";
done;
@iHwy
iHwy / woo-slider-content-filter.php
Created August 25, 2017 00:41 — forked from jaybuys/woo-slider-content-filter.php
Make WooSlider plugin show full HTML content instead of excerpts in slide layout. Place this code in your WordPress theme functions.php file.
<?php
add_filter( 'wooslider_slides_layout_html', 'wooslider_custom_content', 10, 3);
function wooslider_custom_content ( $content, $args, $post ) {
global $post;
$image = get_the_post_thumbnail( get_the_ID() );
if ( 'true' == $args['link_slide'] || 1 == $args['link_slide'] ) {
$wooslider_url = get_post_meta( get_the_ID(), '_wooslider_url', true );
@iHwy
iHwy / function.php
Created August 16, 2017 01:31 — forked from hlashbrooke/function.php
WordPress: Display posts in a random order, but retain persistent pagination
<?php
session_start();
add_filter( 'posts_orderby', 'randomise_with_pagination' );
function randomise_with_pagination( $orderby ) {
if( is_front_page() ) {
// Reset seed on load of initial archive page
@iHwy
iHwy / front-page.php
Created July 12, 2017 16:06 — forked from robincornett/front-page.php
Masonry layout for custom front page (using widgets), as seen on smtwo.org
<?php
//* Front page for smtwo
add_action( 'genesis_meta', 'rgc_fp_meta' );
function rgc_fp_meta() {
if (is_active_sidebar( 'home-main') ) {
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'rgc_home_loop' );
}
/* start new bbpress */
.bbp-topic-voice-count {
display: none;
}
.bbp-topic-reply-count {
color: #aaa;
font-size: 80%;
margin-right: 20px !important;
width: inherit !important;
@iHwy
iHwy / db-connect-test.php
Created March 20, 2016 13:21 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@iHwy
iHwy / empty-wp-plugin.php
Created September 27, 2015 18:33 — forked from sareiodata/empty-wp-plugin.php
Empty WordPress plugin
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
@iHwy
iHwy / wp.sh
Last active August 29, 2015 14:24 — forked from bgallagh3r/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "