Skip to content

Instantly share code, notes, and snippets.

@mustafix
Last active May 23, 2019 06:42
Show Gist options
  • Save mustafix/78b1c47c7b85779f490ab7274adb5b5b to your computer and use it in GitHub Desktop.
Save mustafix/78b1c47c7b85779f490ab7274adb5b5b to your computer and use it in GitHub Desktop.
<?php
global $post;
$args = array(
'posts_per_page' => 3,
'post_type'=> 'slider',
'category_name' =>'sports',
'order'=>'ASC',
'orderby'=>'id'
);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
?>
<?php
$service_icon = get_post_meta($post->ID, 'service_icon', true);
$portfolio_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' ); // Thumbnail (default 150px x 150px max)
$portfolio_medium = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' ); // Large resolution (default 300px x 300px max)
$portfolio_large = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); // Large resolution (default 640px x 640px max)
$portfolio_full = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); // Original image resolution (unmodified)
?>
<div class="col-lg-3">
<div class="box">
<div class="box-gray aligncenter">
<h4><?php the_title(); ?></h4>
<div class="detial">
<i class="fa fa-<?php echo $service_icon; ?> fa-3x"></i>
<a href="<?php echo $portfolio_thumb[0]; ?>"></a>
<img src="<?php echo $portfolio_large[0]; ?>">
</div>
<p><?php the_excerpt(); ?></p>
</div>
<div class="box-bottom">
<a href="#">Learn more</a>
</div>
</div>
</div>
<?php endforeach; ?>
বিঃদ্রঃ ছোট ইমেজ এর লিঙ্ক সব সময় img src="" এর ভেতরে দিতে হবে / আর বড় ইমেজ এর লিঙ্ক img herf="" এর ভেতরে দিতে হবে ।
<?php
// WP_Query arguments
$args = array (
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 10,
'nopaging' => true,
'order' => 'ASC',
'orderby' => 'menu_order',
'tax_query' => array(
array(
'taxonomy' => 'cs_location',
'field' => 'slug',
'operator' => 'IN',
),
)
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
the_tags();
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment