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 href=”http://twitter.com/intent/tweet?text=<?php echo get_site_url(); ?>/<?php echo $slug = basename(get_permalink());?>” class=”tw” target=”_blank”>
<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 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” />


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

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

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

Leave a Reply

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