All · Bootstrap · Google Analytics · Sage · Uncategorised · Wordpress

Add next / previous post links


<div class="navigation">
 <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span>
 <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span>
 </div><!-- /.navigation -->


.nav-next a, .nav-previous a {
 background-color: #FFFFFF;
 border: 1px solid #DEDEDE;
 border-radius: 7px;
 color: #000000;
 cursor: pointer;
 padding: 0.75rem;
 .nav-next a:hover, .nav-previous a:hover {
 background-color: #000000;
 color: #FFFFFF;
 text-decoration: none;
 .nav-next a {
 float: right;

Use default thumbnail if no featured image

<?php if ( has_post_thumbnail() ) { ?>
 <?php the_post_thumbnail('thumbnail'); ?>
<?php } else { ?>
<img width="150" height="150" alt="post-thumb" class="attachment-thumbnail wp-post-image" src="<?php echo get_stylesheet_directory_uri(); ?>/assets/img/default-thumb.jpg">
 <?php }; ?>

Multi except lengths

//change excerpt length
 add_filter('excerpt_length', 'my_excerpt_length');
 function my_excerpt_length($length) {
 if (is_home()){
 return 25;
 else {
 return 50;

Echo site URL

<?php echo get_site_url(); ?>

Get parent page title

 $parent_title = get_the_title($post->post_parent);
 echo $parent_title;

Add onload tag function

 function my_places_add_to_body_load($template) {
 if ( is_page(array ('store-results' ) ) ) {
 ob_start('myplaces_load_js');  // Start Page Buffer
 return $template;
 function myplaces_load_js($buffer) {
 return str_replace('<body','<body onload="load()"',$buffer);

Useful WordPress tutorials and resources


WordPress theme tutorial:–wp-33987

Guide to custom post types (required for almost every site):–wp-27898

Featured images:

Custom post image slider:

Portfolio Tutorial:–wp-20565

Widget Area:

HTML to WordPress theme tutorial:

Installing WordPress locally

Install WordPress locally with XAMPP:

Install WordPress locally with MAMP:


Roots bootstrap theme (we use this for every site):

Advanced custom fields:

ACF repeater field:

ACF gallery field:

ACF options page:

ACF contact form 7 field:

ACF JQuery date picker field:

Contact form 7:

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!