Skip to content

Instantly share code, notes, and snippets.

View stellarcowboy's full-sized avatar

Kenneth White stellarcowboy

View GitHub Profile
<?php
$count = 0;
echo '<ul>';
foreach ( $tickets as $ticket ) {
global $product;
$count++;
if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID );
else $product = new WC_Product( $ticket->ID );
@Lewiscowles1986
Lewiscowles1986 / lc-svg-upload.php
Last active August 4, 2016 13:45
SVG Media Plugin for WordPress (Works since 4.1.2!)
<?php
// Please see https://github.com/Lewiscowles1986/WordPressSVGPlugin from now on
@trepmal
trepmal / gist:1c66dbe97e8f322bc107
Created December 19, 2014 22:42
wp-cli: reset all user passwords
#!/bin/bash
for uid in $(wp user list --field=ID)
do
pass=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32}`
wp user update $uid --user_pass="$pass"
done
@Rarst
Rarst / WordPress.xml
Last active August 5, 2021 04:14
WordPress Live Templates for PhpStorm
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button_1", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<button class='button' id='gform_submit_button_{$form["id"]}'><span><i class='fa fa-share fa-2x'></i> Send </span></button>";
}
//Change hook of gform_submit_button_X to the form that you are using
//Change <span><i class='fa fa-share fa-2x'></i> Send </span> to Font awesome and text of your choice
@ramseyp
ramseyp / hide-editor.php
Created November 12, 2012 15:48
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.
@rodgerthat
rodgerthat / gist:3854960
Created October 8, 2012 21:02
Change / Modify Default WordPress Query from functions.php using pre_get_posts
/*
* Mod Default Query
*
* get at the default query and make your changes before the template ( or whatever is run )
*
*/
function ahso_default_query_mods( $query ) {
// use conditional tags
if ( is_tax('work_cat') ) {
@arod2634
arod2634 / custom-wp-toolbar.php
Created September 30, 2012 01:41
Customize Wordpress Admin Toolbar
<?php
// Customize Admin toolbar if you do desiced to keep it around...
function change_toolbar($wp_toolbar) {
$wp_toolbar->remove_node('comments');
$wp_toolbar->add_node(array(
'id' => 'myhelp',
'title' => 'Help',
'meta' => array('target' => 'help')
));
$wp_toolbar->add_node(array(
@arod2634
arod2634 / custom-wp-editor.php
Created September 21, 2012 20:43
Customize Wordpress Editor
<?php
// Remove Meta-Boxes from Posts & Pages Editor Screens
function remove_extra_meta_boxes() {
remove_meta_box( 'postcustom' , 'post' , 'normal' ); // custom fields for posts
remove_meta_box( 'postcustom' , 'page' , 'normal' ); // custom fields for pages
remove_meta_box( 'postexcerpt' , 'post' , 'normal' ); // post excerpts
remove_meta_box( 'postexcerpt' , 'page' , 'normal' ); // page excerpts
remove_meta_box( 'commentsdiv' , 'post' , 'normal' ); // recent comments for posts
remove_meta_box( 'commentsdiv' , 'page' , 'normal' ); // recent comments for pages
remove_meta_box( 'tagsdiv-post_tag' , 'post' , 'side' ); // post tags
@arod2634
arod2634 / custom-wp-widgets.php
Created September 21, 2012 19:46
Customize Wordpress Theme Widgets
<?php
/*
* Remove any unwanted widgets...
*
* WP_Widget_Pages = Pages Widget
* WP_Widget_Calendar = Calendar Widget
* WP_Widget_Archives = Archives Widget
* WP_Widget_Links = Links Widget
* WP_Widget_Meta = Meta Widget
* WP_Widget_Search = Search Widget