WordPress: Custom Code snippets

Custom Social share:
<div class=”socialBG”>
<a href=”http://www.facebook.com/sharer/sharer.php?u=<?php echo get_site_url(); ?>/<?php echo $slug = basename(get_permalink());?>” class=”FB” target=”_blank”>
</a>
<a href=”http://twitter.com/intent/tweet?text=<?php echo get_site_url(); ?>/<?php echo $slug = basename(get_permalink());?>” class=”tw” target=”_blank”>
</a>
<a href=”http://pinterest.com/pin/create/button/?url=<?php echo get_site_url(); ?>/<?php echo $slug = basename(get_permalink());?>&media=<?php echo $url; ?>&description=<?php echo the_title() ?>” class=”pin-it-button” count-layout=”horizontal” target=”_blank”>
</a>
<a href=”mailto:mail@domain.com?subject=word+word+word+word&body=<?php echo the_title()?>: <?php echo get_permalink() ?>”>
<img src=”<?php echo get_template_directory_uri(); ?>/images/mail.png” title=”Mail link to friend” />
</a>

</div>

Get Featured image url:
<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); 
echo $url;?>
or
<img scr=<?php echo $url;?>” />

Custom Nav in post:
<span class=”left”>
<?php previous_post(‘%’, ‘<< Previous post’, ‘no’); ?>
</span>
<span class=”right”>
<?php next_post(‘% ‘, ‘Next post >>’, ‘no’); ?>
</span>

Get post Tags:
<p class=”tags”>
<?php the_tags( ‘<span class=”name”>Tags:</span> ‘, ‘, ‘, ‘<br />’ ); ?>
</p>

Leave a Reply

Your email address will not be published. Required fields are marked *