WordPress Helpers
2014-06-05
The following are scripts and settings that I typically use when working in WordPress. They are here for me to reuse, but please feel free to use yourself!
Category Permalinks
http://example.com/%category%/%postname%/
Featured Image URL
Get it
$img = wp_get_attachment_image_src ( get_post_thumbnail_id ( $post -> ID ), 'single-page-thumbnail' );
Use it php
<?php
echo '<div class="post-featured-image" style="background-image:url(' . $img [ 0 ] . ');filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' . $img [ 0 ] . ', sizingMethod="scale");-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' . $img [ 0 ] . ', sizingMethod="scale");"></div>'
?>
Use it HTML
<div class= "post-featured-image" style= "background-image:url(<?php echo $img[0] ?>);filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=<?php echo $img[0] ?>, sizingMethod=" scale "); -ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src= <?php echo $ img [0] ? > , sizingMethod="scale");"></div>
waka