Rules to Better WordPress

Hold on a second! How would you like to view this content?
Just the title! A brief blurb! Gimme everything!
  1. Do you know how to share a private link of a draft post?

    To share a draft of a post with others you need to install a plugin.

    The plugin is called 'Simple Preview' and can be located here​.

    Once you have plugin installed, all you need to do is enable it and then follow the steps below:

    1. In the 'Edit Post' page, scroll down below your HTML panel to the 'Preview' panel, and select the tick box "Allow Anonymous Preview".
      Once enabled, it will create a preview link, that you can send to as many people as you like.
      Note: Once you publish the post the URL becomes inactive.
    2. Click on 'Save Draft', then 'Preview'. The post will open in your browser, with the URL that you can share.
    NOT Done Email Figure: How to enable ‘Allow Anonymous Preview’ so you can share your URL before going live NOT Done Email Figure: The URL suffix will be similar to this: ‘…?p=1418&preview=true’

    More Information:

    Note #1: needing a plugin to share a URL privately, is a little bit crazy.

    Note #2: Another solution is ‘Share a Draft’, however it has more options and is more complicated.

    It has a time limit function for the post, which allows you to set and extend. The URL it generates is a bit messy.

    NOT Done Email Figure: The URL is pretty messy and it is not as simple as just ticking a box. This is a whole other page
  2. Do you backup your WordPress site to an external provider like Dropbox?

    ​Backing up your WordPress site is important and while most hosting providers will perform backups on your behalf, it doesn’t hurt to have another copy tucked away safely. For this purpose we use and recommend the BackWPup WordPress plugin​.

    It simplifies WordP​ress backups and can be configured to back up your site to:

    • FTP server
    • Dropbox
    • Amazon S3 services
    • Microsoft Azure
    • RackSpaceCloud
    • SugarSync​

    We setup our WordPress sites to backup daily to Dropbox:

    wp-dropbox.png
    Figure: AdamCogan.com blog backs up daily to Dropbox

    For more information head over to: https://wordpress.org/plugins/backwpup

  3. Do you know how to create posts via email?

    If you ever need to create a new post to your blog without access to WordPress admin area (/wp-admin) you can do it via email, thanks to the Jetpack plugin.​ Watch how you do it on Ben Cull's video:

     

    ​​​

  4. Do you know how to deploy changes from Staging to Live?

    Pushing Staging to Live

    By default, only your files will be copied back to LIVE. You can move content by checking the tables you would like to move below. Keep in mind these tables will replace the LIVE version with the STAGING version. So for instance, if you choose to move wp_posts all posts added to the LIVE site since the staging site was created will be removed. However, a checkpoint of your site will be created so you can 'undo' the changes if necessary.

    After logging into your live site's /wp-admin click the WP Engine button on the top left-hand side. Then, click the "Staging" tab.

    staging-tab.jpg
    Figure: Staging tab in WordPress

    Then, choose from the following options:

    wp-tables.png

    When pushing changes from staging to live the file system from staging does not overwrite the live file system but instead, merges with the live file system. 

    This means any updated files in staging will be updated on live after a push, but any deleted files in staging would not be deleted in live.

    If you want to push all changes, except for pages, posts and users to your live site, select all database tables except:

    • wp_posts,
    • wp_postmeta,
    • wp_users and wp_usermeta.

    ​If you push no database tables, only changes to theme files, core WordPress files and plugin files will be pushed to the live site.

    If you select all tables, any new posts, pages or users changes made to the live site during your work in the staging area will be overwritten.

  5. Do you optimize your images for web?

    A nice looking image can be harmful to your website if it's not optimized. It's important to optimize images for the web because the fewer bytes the browser has to download, the less bandwidth the client uses and the faster the browser can download and render your content on the screen.​

    The first thing is to save your graphics in the right format. After that, you should run an image optimizer. 

    Some tips and techniques to keep in mind as you work on optimizing your images:

    • Don't be afraid to dial down the "quality" settings if the results are very good and byte savings are significant
    • Remove unnecessary image metadata like geo information, camera information, and so on. 
    • Use automated tools to ensure that all of your images are always optimized. E.g.: http://optimizilla.com​
    optimizeexample.png
    Figure: Optimizilla reduced the image below in 31%

    WordPress

    If your website is running on WordPress you should install and activate the plugin WP Smush. It scans every image you upload – or have already added to your site – cuts all the unnecessary data and scales it for you before adding it to your media library.

    wp-smush.jpg
    Figure: WP Smush plugin saved 9.4MB from one web site
  6. Do you use "301" code to redirect renamed or moved pages?

    Don't lose your Google juice when you rename a file. Do not use META refresh to redirect pages - "301" code is the most efficient and Search Engine Friendly method for webpage redirection. There are different ways to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, always use the code "301", which is interpreted as "moved permanently".​

    How to do a "301" redirect in .aspx

    Any time you move a page or just delete a page you should add a "301" redirect to a new page or a page for missing pages.
    1. You can add a 301 redirect in code

       <% Response.RedirectPermanent("NEW PAGE URL HERE") %>

      Although this works well it is difficult to manage the list of redirects and you need to keep the page around.
    2. You can write an HTTP handler
      This is better as you can choose where to store the redirect list, but you still need to manage a custom codebase.
    3. You can use rewrite maps in IIS URL Rewrite to add a number of redirects
      See Storing URL rewrite mappings in a separate file  for an explanation of how to use rewrite maps.
    Note: If you are using a source control, like TFS, lock the old file so no-one can edit it by mistake.

    WordPress

    WordPress automatically redirects posts when you change the URL (permalink). No further action is required.

  7. Do you use ‘read more’ WordPress tag to show summary only on a blog list?

    ​By default WordPress shows the whole article content on a post list. Knowing that some posts are quite long - taking a lot of real estate on the page - it's a good idea to summarize it and add a "read more" link.​

    You can split your blog entries so that only the first part of certain posts is displayed on the home and archive pages. When you do this, a link will be placed after the intro, pointing the reader to the full post.

    To do so, you can either edit the source index.php (or similar) file; or just click the "Read More" tag button in the first row of the visual editor toolbar (or press Alt+Shift+T):

    replace <?php the_content(); ?> with <?php the_excerpt(); ?>

    Figure: Bad example - changing source php files is complicated and require developer skills
    Figure: Good example - click on the "Read More" tag on the post visual editor

    Note: This is out-of-the-box with WordPress. You won't need a plugin.

    Custom Read More Message

    To customize the message, simply add a space after <!--more and insert the text you want to show:

    <!--more Read the full post --> ​

    Figure: Custom "read more" link

    Some WordPress themes do this automatically

    Many WordPress themes will have an option to not show the full blog content on the homepage. E.g. in Avada (one of the most popular themes) it has this:

    excerpt.png
    Figure: Many WordPress themes makes it easier to you

    Always check theme options before going back through posts to add in the Read More tags manually.