Archive for September, 2013

15 September, 2013 — Development, Snippets, WordPress

Display A Message On Older Posts

When blog posts get old, sometimes the information in them is not as accurate as they were at the time of writing. This can be misleading and can cause confusion to the reader.

This simple bit of code when either placed in your themes funcions.php file or a functionality plugin will display a message at the top of any posts that are older than 1 year. You can customise the message in the code below and add some styles to your style.css file. Once done upload your file WordPress will automatically take care of the rest.

// display a message on older posts
function tb_older_post_message () {
    $posted = get_the_time('U');
    $current = current_time('timestamp');
    //Convert difference in seconds to days
    $diffTime = ($current - $posted) / (60*60*24);
    if($diffTime > 365){
        echo '<div class=older-post-message>' . __('This post was written more than a year ago and <em>might</em> not be entirely accurate anymore.', 'wptips') . '</div><br />';
    }
}
add_action('get_template_part_content','tb_older_post_message');
8 September, 2013 — Life

301 Redirect to a New Domain

Every once in a while you might want to move your blog from one domain to another. This can get very messy if you don’t set-up a 301 redirect properly. By setting up a 301 redirect you keep all the SEO value and your readers are automatically sent to the page they are looking for, only on your new domain.

For example, if you go to http://oldsomain.com/page1 it will automatically send the reader to http://newdomain.com/page1.

Whats the code?

To get this to work simply go to your web hosting FTP or file manager and find the .htaccess file. Edit that file and replace its contents with the following:

# BEGIN WordPress   
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www.oldsite.com RewriteRule (.*) 
http://www.newsite.com/$1 [R=301,L] 
# END WordPress

Make sure your replace oldsite.com with your old domain name. And newsite.com to your new domain. Be sure not to edit any of the other code as this will affect the way the htaccess file will work.

Once you have done this, upload the .htaccess file to your web host and remove all old WordPress file and your done.
Just make sure you check that everything is working ok.

5 September, 2013 — Blogging, Development, Tech, WordPress

Pressgram Hits the App Store!

John Saddington a former founder of 8BIT has a little project he started over at Kickstarter. Pressgram v1.0Pressgram is an Instagram like application that will allow its users to take photos using there iOS device, add filters and publish them right to a WordPress website all while drinking a cup of coffee! While some people might think whats the point – I may as well just use Instagram? Well a few months ago now Instagram was purchased by Facebook and not long after that decided it would change its Terms of Service to allow itself to effectively sell your photos for profit without your permission and without paying you a penny. To sum all of that up in one sentence… Instagram owns your photos from the moment they hit there servers! This was when John decided this wasn’t right – photos uploaded should remain the property of the user who took and uploaded the photo. Allowing full creative control to that user. This was when Pressgram