This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: BWW - Event Status Updater | |
Description: Automatically updates event status from Upcoming to Past based on the event end datetime. Verifies Action Scheduler functionality is available. | |
Version: 2024.03 | |
Plugin URI: https://brilliantly.net | |
Author: Brilliant Web Works, Inc. | |
Author URI: https://brilliantly.net | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'kadence_blocks_pro_posts_grid_query_args', 'sort_by_date_post_grid_order',10, 2 ); | |
function sort_by_date_post_grid_order( $args, $attributes ) { | |
if ( 'POST_TYPE_SLUG_HERE' === $args['post_type'] && isset($attributes['className']) && strpos($attributes['className'], 'BLOCK_CLASS_HERE') !== false ) { | |
$args['meta_key'] = 'start_date'; | |
$args['orderby'] = 'meta_value'; | |
$args['order'] = 'ASC'; | |
} | |
return $args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Custom Security Functions | |
Plugin URI: https://nathaningram.com | |
Description: Security Hardening for Core WordPress | |
Version: 2023.11 | |
Author: Nathan Ingram | |
Author URI: https://nathaningram.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ADD SKUS | |
// Runs on update - use Quick Edit | |
function ni_append_sku_to_short_description($post_id) { | |
if ('product' !== get_post_type($post_id)) { | |
return; | |
} | |
$product = wc_get_product($post_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Removes empty lines in Woo Product Long + Short Descr when 2 or more occur together | |
// Removes empty spaces at beginning or end of descriptions | |
// Fires on Post Update (works with Quick Edit) | |
add_action('save_post_product', 'ni_clean_up_product_content', 10, 3); | |
function ni_clean_up_product_content($post_ID, $post, $update) { | |
// Check if it's an update | |
if ($update) { | |
// Get the content and short description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* looped archive pages align elements */ | |
.custom-archive-loop-item {display: flex; flex-direction: column; background-color:#fff;} | |
.custom-archive-loop-item .kb-row-layout-wrap {flex: 1; display: flex; flex-direction: column;} | |
.custom-archive-loop-item .wp-block-kadence-accordion, .custom-archive-loop-item .wp-block-kadence-advancedbtn {margin-top: auto;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_next_third_tuesday() { | |
$date = new DateTime(); | |
$date->modify('first day of this month'); | |
while ($date->format('D') != 'Tue') { | |
$date->modify('next day'); | |
} | |
$date->modify('+2 weeks'); | |
if($date < new DateTime()) { | |
$date->modify('first day of next month'); | |
while ($date->format('D') != 'Tue') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sanitizes HMTL from Woocommerce Product Descriptions upon post Update | |
function sanitize_product_description( $post_id ) { | |
// check if post is a product | |
if ( 'product' === get_post_type( $post_id ) ) { | |
// get the post object | |
$product = wc_get_product( $post_id ); | |
// sanitize the descriptions | |
foreach ( ['description', 'short_description'] as $desc_type ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to sort settings menu items alphabetically | |
function ni_sort_settings_menu_items_alphabetically() { | |
global $submenu; | |
// Check if the settings menu exists | |
if (isset($submenu['options-general.php']) && is_array($submenu['options-general.php'])) { | |
// Sort the items under the settings menu alphabetically | |
usort($submenu['options-general.php'], function ($a, $b) { | |
// Ensure both array elements have the 0-index set and are strings | |
if (isset($a[0]) && isset($b[0]) && is_string($a[0]) && is_string($b[0])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add the code to your theme's functions.php file | |
function exclude_categories_from_shop_page( $query ) { | |
if ( ! is_admin() && is_shop() && $query->is_main_query() ) { | |
$tax_query = array( | |
array( | |
'taxonomy' => 'product_cat', | |
'field' => 'slug', | |
'terms' => array('unlimited-power', 'weapons'), | |
'operator' => 'NOT IN' |
NewerOlder