Post-States

add_filter( ‘display_post_states’, ‘bu_style_post_state_bricks’, 15, 2 ); function bu_style_post_state_bricks ($post_states, $post) { if( isset( $post_states[‘bricks’] ) ) { if( current_user_can( ‘edit_posts’, $post->ID ) ) { $bricks_edit_link = get_permalink($post->ID) . ‘?bricks=run’; $post_states[‘bricks’] = ‘‘ . $post_states[‘bricks’] . ‘‘; } else { $post_states[‘bricks’]…Continue reading

Disable Attachment Pages (copy)

add_action( ‘template_redirect’, function () { global $post; if ( ! is_attachment() || ! isset( $post->post_parent ) || ! is_numeric( $post->post_parent ) ) { return; } // Does the attachment have a parent post? // If the post is trashed, fallback…Continue reading

Gravity Custom Code

/* ————————————————————————- * * Gravity Form: Replace custom merge tags /* ————————————————————————- */ add_filter( ‘gform_replace_merge_tags’, function ( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) { if ( strpos( $text, ‘{current_hour}’ ) !== false ) { $text = str_replace( ‘{current_hour}’,…Continue reading

Add Orders link to the top admin toolbar

function add_link_to_admin_bar($admin_bar) { $args = array( ‘id’ => ‘orders’, ‘title’ => ‘~ ORDERS ~’, ‘href’ => esc_url( admin_url( ‘edit.php?post_type=shop_order’ ) ) ); $admin_bar->add_node($args); } add_action(‘admin_bar_menu’, ‘add_link_to_admin_bar’, 999);Continue reading

Add Orders link to the top admin toolbar

function add_link_to_admin_bar($admin_bar) { $args = array( ‘id’ => ‘orders’, ‘title’ => ‘~ ORDERS ~’, ‘href’ => esc_url( admin_url( ‘edit.php?post_type=shop_order’ ) ) ); $admin_bar->add_node($args); } add_action(‘admin_bar_menu’, ‘add_link_to_admin_bar’, 999);Continue reading

Add Products Link to the Top Admin Toolbar

function add_link_to_admin_bar_2($admin_bar) { $args = array( ‘id’ => ‘products’, ‘title’ => ‘# PRODUCTS #’, ‘href’ => esc_url( admin_url( ‘edit.php?post_type=product’ ) ) ); $admin_bar->add_node($args); } add_action(‘admin_bar_menu’, ‘add_link_to_admin_bar_2’, 999);Continue reading