Tags » Wordpress 2

You Write It Wednesday 

What made you smile today?

I have enjoyed this week more than most. Spring is definitely in the air and this is day three being stress free. 66 more words

Life

Add a media image and featured image from a URL

When we import data than mostly need to dynamically add a featured image or custom post type from another domain than we need to add image in media with featured image. 136 more words

WordPress

WordPress search in custom post meta

Searching in custom post meta as like WooCommerce SKU.

add_filter( 'posts_where', 'codyfy_search_where' );
function codyfy_search_where( $where ){
    global $pagenow, $wpdb;
    $class_status = $_GET['s'] ? $_GET['s'] : ''; 
    if ($_GET['s'] != '') {
        $where = preg_replace(
       "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
       "(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_key LIKE '_sku' AND ".$wpdb->postmeta.".meta_value LIKE $1) ", $where );
    }
	
    return $where;
}

add_filter('posts_join', 'codyfy_search_join' );
function codyfy_search_join ($join){
    global $pagenow, $wpdb;
    if ( $_GET['s'] != '') {    
        $join .='LEFT JOIN '.$wpdb->postmeta. 18 more words
WordPress

📚 - SoundCloud

Listen to 📚 by Brian Anthony Hardie #np on #SoundCloud

Avant-Garde Art

Papaya - Atop a Tree

Deliciously sweet with musky undertones and a soft, butter-like consistency, it is no wonder the papaya was reputably called the “fruit of the angels” by Christopher Columbus. 135 more words

Photography