Skip to content

Instantly share code, notes, and snippets.

View hirozed's full-sized avatar

Jamie Reevior hirozed

View GitHub Profile
@hirozed
hirozed / revphp1.php
Last active January 25, 2021 20:51
Reverse PHP - One Line
?> <?php
@hirozed
hirozed / php.php
Last active January 25, 2021 20:50
PHP Block
<?php
?>
@hirozed
hirozed / revphp.php
Last active January 25, 2021 20:50
Reverse PHP
?>
<?php
@hirozed
hirozed / cmb2.php
Last active September 8, 2021 15:51
WordPress CMB2 Base
<?php
/**
* Reason for CMB2 box
*/
function cmb2_admin_init() {
$prefix = 'add_prefix_here';
// Create the box.
$cmb2 = \new_cmb2_box(
array(
@hirozed
hirozed / cmb2-group.php
Last active January 17, 2021 05:32
WordPress CMB2 Group
<?php
/**
* Reason for CMB2 box
*/
function create_[cmb2]_group_box() {
// Create the box.
$cmb2 = \new_cmb2_box(
array(
'id' => '[CHANGEME-id]',
'title' => __( '[CHANGEME-title]', '[CHANGEME-localization]' ),
@hirozed
hirozed / cmb2-wysiwyg.php
Last active January 17, 2021 05:32
WordPress CMB2 Rich Text Field
<?php
$cmb->add_field(
array(
'name' => __( '[CHANGEME-name]', '[CHANGEME-localization]' ),
'id' => '[CHANGEME-id]',
'desc' => __( '[CHANGEME-description]', '[CHANGEME-localization]' ),
'type' => 'wysiwyg',
'options' => array(
'textarea_rows' => 1,
'media_buttons' => false,
@hirozed
hirozed / class.php
Last active February 16, 2021 20:16
WP Class Skeleton
<?php
/*
* [Class Title]
*/
class [className] {
/**
* Class Instance.
*
@hirozed
hirozed / wp-cpt.php
Last active February 1, 2022 21:00
WordPress Post Type
<?php
/**
* Hook to create the Custom Post Type.
*/
function action_cpt() {
$cpt_name = __( '[Singular Name]', '[localization]' );
$cpt_plural = __( '[Plural Name]', '[localization]' );
$labels = array(
'name' => $cpt_name,
@hirozed
hirozed / wp-debug.php
Last active January 17, 2021 05:30
WordPress wp-config debug
define( 'DISALLOW_FILE_EDIT', true );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SAVEQUERIES', true );
define( 'SCRIPT_DEBUG', true );
@hirozed
hirozed / wp-media.php
Last active March 16, 2021 15:07
WP CLI Media Regenerate
wp media regenerate $(wp post list --format=ids --post_type=attachment --post_mime_type=image/jpeg --year=2020 --url=[url]) --only-missing --url=[url]
//BU Version
sudo -u wpcms bash
wp media regenerate $(wp post list --format=ids --post_type=attachment --post_mime_type=image/jpeg --year=2020 --monthnum=07 --url=https://www.bu.edu/) --yes --only-missing --url=https://www.bu.edu