Created
December 28, 2015 00:11
-
-
Save sarvar/e6096e39e8c4927314e7 to your computer and use it in GitHub Desktop.
Get attachment image
This file contains hidden or 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 query_posts('category_name=Portfolio&order=ASC&orderby=date&posts_per_page=36'); ?> | |
| <?php if (have_posts()) : ?> | |
| <?php while (have_posts()) : the_post(); ?> | |
| <?php | |
| $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' ); | |
| $url = $thumb['0']; | |
| ?> | |
| <li><a style="background-image:url(<?=$url?>);" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"></a></li> | |
| <?php endwhile; ?> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment