Created
September 26, 2018 07:38
-
-
Save unaibamir/82a98af3910667ba4fc833d965f0ec4d to your computer and use it in GitHub Desktop.
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 | |
$args = [ | |
"s" => "logo", | |
"post_type" => "product", | |
"posts_per_page" => 5, | |
"post_status" => "publish" | |
]; | |
$the_query = new WP_Query( $args ); | |
if( $the_query->found_posts > 0 ) { | |
/*echo "<pre>"; | |
print_r($the_query->posts); | |
echo "</pre>";*/ | |
echo "<ul>"; | |
foreach ($the_query->posts as $product) { | |
$product_id = $product->ID; | |
echo "<li>"; | |
echo $product->post_title; | |
echo get_the_post_thumbnail( $product, 'thumbnail', ["class"=>"img-responive", "data-adnan" => "Khan"] ); | |
echo "</li>"; | |
} | |
echo "</ul>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment