Skip to content

Instantly share code, notes, and snippets.

View coderaaron's full-sized avatar

Aaron Graham coderaaron

  • St. Louis, MO
  • 10:42 (UTC -05:00)
View GitHub Profile
<?php
$the_query = new WP_Query( array(
'post_type' => 'items',
'tax_query' => array(
array (
'taxonomy' => 'washu_ppi_items_types',
'field' => 'slug',
'terms' => 'apartments',
)
),
sed -i '' -e $'s/&lt;/\</g' Diso\ v2.html && sed -i '' -e $'s/&gt;/\>/g' Diso\ v2.html && sed -i '' -e $'s/&quot;/\'/g' Diso\ v2.html
@coderaaron
coderaaron / rendered-content.php
Last active March 13, 2020 02:34
Convert content with shortcodes to rendered HTML and update post
<?php
define( 'PPI_FOR_EXPORT', 1 );
$a = get_pages();
foreach( $a as $b ) {
$f = $b->ID;
$c = get_post_field( 'post_content', $f );
remove_filter('the_content', 'wpautop');
$d = apply_filters( 'the_content', $c );
$my_post = array(
mysql -e "SELECT c.post_title, c.post_content FROM wp_posts a, wp_postmeta b LEFT JOIN wp_posts c ON c.ID = b.meta_value WHERE a.post_type = 'nav_menu_item' AND b.meta_key = '_menu_item_object_id' AND a.ID = b.post_id ORDER BY a.menu_order" -u wp -pwp diso --xml > test.xml
sed -i -e $'s/&lt;/\</g' test.xml
sed -i -e $'s/&gt;/\>/g' test.xml
sed -i -e $'s/&quot;/\'/g' test.xml
sed -i -e $'s/&amp;/\&/g' test.xml
sed -i -e $'s/<!--[^>]*>//g' test.xml
sed -i -e $'s/<a[^>]*>//g' test.xml
sed -i -e $'s/<img[^>]*>//g' test.xml
sed -i -e $'s/<\/a>//g' test.xml
sed -i -e $'s/ id=\'[^\']*\'//g' test.xml
@coderaaron
coderaaron / gitmoji.sh
Created June 4, 2019 19:36
Use Emoji in Git commits
function gcap() {
git add . && git commit -m "$*" && git push
}
#bug
function gbug() {
gcap "🐛 BUG: $@"
}
#improvement
function gimp() {
gcap "↗️ IMPROVEMENT: $@"
@coderaaron
coderaaron / pre-commit
Created May 12, 2014 14:10
Pre-commit hook to bump version number
#!/bin/sh
# Standard WUSM version numbering:
# year.month.day.commit
#
# This script searches all files in the git repo
# and bumps the version number
new=$(date +"%y.%m.%d.0")
a=( ${new//./ } )
file=$(grep -lir "Version:" *.php)