Redirect HTTP to HTTPS

Since Google announced that they were going to start using HTTPS as part of their ranking you would of seen a vast amount of websites switching to use HTTPS instead of using HTTP.
If you are switching your site to use HTTPS you need to remember that all your pages that are indexed into Google or websites that are linking to your site will still be pointing to your old HTTP page. Therefore you need to make sure that you redirect all non-HTTPS pages to HTTPS.

Redirect With htaccess

If you are using an apache server then you can use the following code snippet and enter it into your htaccess file.
This will search for anything coming in on port 80 which is the default for HTTP and will redirect it to HTTPS.
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://{HTTP_HOST}/$1 [R=301,L]

Redirect On Nginx

If you are using an Nginx then you can add the following into your server conf. This will listen to requests on port 80 and redirect to your server with a HTTPS prefix, all you have to do is replace theexample.com with your own domain.
server {
    listen      80;
    server_name example.com;
    return 301   https://$server_name$request_uri;
}

WordPress Recent Posts Shortcode

On WordPress.com you automatically get are a large number of shortcodes that you can use on your blog. Here you can view all the default shortcodes on WordPress.com.
One of these shortcodes is to display the most recent posts by using the shortcode display posts.
The below is a code snippet you can use to add a list of the most recent posts and the date they were published. This shortcode displays the last 10 posts in a list anywhere you use the shortcode. The attributes on the shortcode will be passed into the WP_Query object therefore if you want to change what posts are displayed by simply changing the attributes on the shortcode.
/**
 * Shortcode to display the most recent posts
 * The attributes passed into the function will be passed into the WP_Query object to modify the query
 * By default the last 10 posts will be displayed
 * 
 * @param $atts
 * @param $content
 * 
 * @return string
 */
function pu_recent_posts_shortcode($atts, $content = NULL)
{
    $atts = shortcode_atts(
        [
            'orderby' => 'date',
            'posts_per_page' => '10'
        ], $atts, 'recent-posts' );
    
    $query = new WP_Query( $atts );

    $output = '<ul class="recent-posts">';

    while($query->have_posts()) : $query->the_post();

        $output .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a> - <small>' . get_the_date() . '</small></li>';

    endwhile;

    wp_reset_query();

    return $output . '</ul>';
}
add_shortcode('recent-posts', 'pu_recent_posts_shortcode');

Stop WordPress Automatically Adding br

WordPress uses a function called wpautop to automatically add paragraphs and line breaks to your content from the content editor. This will change double line breaks and convert them into a HTML paragraph.
<?php wpautop( $foo, $br ); ?>
This takes two parameters the first being the text that needs to be converted, the second being a boolean value, defaults to true which will take line breaks and convert these to line breaks.
There are certain situations in your editing where you want to stop WordPress automatically adding line breaks in your content. To do this you need to replace the default wpautop and pass in a false as the second parameter to stop WordPress adding the HTML line breaks (<br />).
Add the following to your functions.php file to stop WordPress adding the line break.
// Remove the default filters
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

// Add the new function to be the the_content and the_excerpt filter
add_filter( 'the_content', 'pu_wpautop_without_br' , 99);
add_filter( 'the_excerpt', 'pu_wpautop_without_br' , 99);

/**
 * Create a new function that uses the default wpautop function passing in a false as the second parameter to stop adding line breaks
 */
function pu_wpautop_without_br( $content ) 
{
    return wpautop( $content, false );
}