I hereby claim:
- I am majemedia on github.
- I am majemedia (https://keybase.io/majemedia) on keybase.
- I have a public key whose fingerprint is 902E 807B BAB1 2597 F0DC 4C52 8FBE 28CE 868F 7531
To claim this, I am signing this object:
<?php | |
/* | |
* Not only can you reuse this throughout your application for added flexibility but | |
* it gives you added flexibility for scheduling your stuff. | |
* The default WordPress cron intervals are, as of this writing: | |
* - Hourly | |
* - Twice Daily | |
* - Daily | |
*/ |
function GetAttachedMediaMinusFeaturedImage( INT $postId ) { | |
$featuredImage = get_post_thumbnail_id( $postId ); | |
$attached_media = get_attached_media( NULL, $postId ); | |
unset( $attached_media[ $featuredImage ] ); | |
return $attached_media; | |
} |
function GetSentenceList( ARRAY $things, STRING $operator = "and", BOOL $oxfordComma = TRUE ) { | |
if( empty( $things ) ) { | |
return FALSE; | |
} | |
$oxford = ( $oxfordComma ) | |
? ', ' | |
: ' '; |
/* | |
* This usually goes in an mu-plugins file but for now here it is on its own | |
* This will pretty print anything to the screen (so you can safely have WP_DEBUG_DISPLAY FALSE | |
* The styles are specific to the default dashboard layouts | |
*/ | |
if( ! function_exists( '_frontlog' ) ) { | |
function _frontlog( $message ) { | |
echo "<pre style='background-color:white;margin-left:159px;border:1px solid black;padding:15px;'>"; |
if( ! function_exists('_log') ) { | |
/** | |
* @description Takes any message and sends it to the error_log. Due to how php's serialize works (will add binary characters) and that error_log will truncate when it hits a binary character a str_replace is used. | |
* | |
* @param $message mixed anything you want to print out | |
*/ | |
function _log( $message ) { | |
error_log( str_replace( "\0", "[NULL]", print_r( $message, TRUE ) ) ); |
function SetSearchArgs( $formattedArgs, $args = [] ) { | |
if( isset( $args[ 'post_type' ] ) && ( count( $args[ 'post_type' ] ) > 1 || gettype( $args[ 'post_type' ] ) === 'string' ) ) { | |
if( gettype( $args[ 'post_type' ] ) === 'array' ) { | |
$existing_query = $formattedArgs[ 'query' ]; | |
unset( $formattedArgs[ 'query' ] ); |
SELECT main.lead_id | |
FROM wp_rg_lead_detail as main | |
WHERE main.form_id = 1 | |
AND main.lead_id NOT IN ( | |
SELECT wp_rg_lead_detail.lead_id | |
FROM wp_rg_lead_detail | |
WHERE wp_rg_lead_detail.form_id = 1 | |
AND wp_rg_lead_detail.field_number = 102 | |
AND wp_rg_lead_detail.value <> '' | |
) |
/* | |
This query looks into post fields and returns an ordered list of results based on the attached categories to the posts searched. | |
This can be used to help weight results or to potentially show links to categories instead of the posts themselves. | |
Can be modified to add additional filters. Still not sure how to tie this into pre-get-posts but working on it. | |
+------------+---------+--------------+ | |
| name | term_id | result_count | | |
+------------+---------+--------------+ | |
| Category A | 15 | 12 | | |
| Category C | 17 | 12 | |
SET @domains='domain1.com|domain2.com'; | |
UPDATE wp_users prod_users, | |
( select ID FROM wp_users WHERE user_email NOT REGEXP @domains) clone_users | |
SET prod_users.user_email = CONCAT('DC_', prod_users.ID, '@example.org') | |
WHERE prod_users.user_email NOT REGEXP @domains; |
I hereby claim:
To claim this, I am signing this object: