Want to make A CSS if meta key value is empty

you won’t need css for that // Create the widget output. public function widget( $args, $instance ) { $prod_image_url = get_post_meta( ‘prod_image_url’ ); if(!empty($prod_image_url)){ echo $args[‘before_widget’] . $args[‘before_title’] . $args[‘after_title’]; if( is_single() ): ?> <div id=”show”> <img class=”prodimage” src=”https://wordpress.stackexchange.com/questions/253903/<?php echo ( get_post_meta( get_the_ID(),”prod_image_url’, true ) ); ?>”/><br> </div> <?php else: echo ”; endif; } ?> … Read more

Get posts with same meta value as current post

You should first get the meta value for the current post, then use it to make another query. global $authordata, $post; $my_meta = get_post_meta( $id, ‘stashkey’, true); $authors_posts = get_posts( array( ‘author’ => $authordata->ID, ‘post_parent’ => 0, ‘orderby’ => ‘menu_order’, ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘stashkey’, ‘value’ => … Read more