business & technology for wedding and lifestyle pros
All Posts in Category: WordPress

You Need a Test Site


Big red flashing word of warning!

Be super-careful when you are following these instructions and be very sure not to edit the web server or database for your actual website!  Always be sure that you have backed up your database and web server before doing this, just in case.

You need a test site.

Creating a WordPress Test Site

Photo: © Studio Firma / Stocksy

So how do you set up a test site for your WordPress blog?  First, purchase a separate domain name (anything works) and set it up for hosting.  Then, take the following steps to copy your production site (the techie term for your user-visited website) to your test site.

If you are using VaultPress, you can use their automated restore to a new site feature. However, if you have a large number of uploads, the restore will take a bit of time.

Let’s say your production site is www.mycookingsite.com/blog and your test site is www.mytestsite.com/blog.

Step 1: Copy your web server
  1. FTP the following files and folders from www.mycookingsite.com/blog/ to your computer or hard drive Note that I’m ignoring your wp-content/uploads folder, as there is really no need to upload your image library):
    • wp-admin
    • wp-content/themes
    • wp-content/plugins
    • wp-content/upgrade
    • wp-content/index.php
    • wp-includes
  2. On your computer or hard drive, delete the plugin folder for Jetpack if you have it enabled.  This is to insure that you do not confuse the WordPress stat engine when you create your test site.
  3. FTP all of the individual files that are at the same level as the wp-admin, wp-content, and wp-includes folder to your computer or hard drive.
  4. FTP all of the files from your computer or hard drive into www.mytestsite.com/blog/.

You’ve now made a copy of everything on your web server except your images (no need to have these on your test site).

Step 2: Copy your database

If you are using VaultPress:

  1. Navigate to your Backups.
  2. View your most recent backup.
  3. Click the Download button and select only the Database.
  4. Prepare backup and wait for VaultPress to email you with the link to your backup.
  5. You will receive a gzip file containing your database tables.

Non-VaultPress Option:

  1. Download the nifty WordPress Database Backup plugin.
  2. Go to Tools » Backup and run a backup of your entire database.

Step 3: Import your database

  1. Create a new SQL database through your web hosting company.
  2. Through your web hosting company, there should be a service called phpMyAdmin.  Log into phpMyAdmin using the username and password for your database.
  3. Select your newly-created database in phpMyAdmin and click on the “Import” tab.
  4. Browse for your backup file, be sure that the format selected is “SQL”, and click Go.
Step 4: Update your test database’s WordPress options
  1. In phpMyAdmin, click on your test database, and the table wp_options (or wp_xxxxxx_options).  BE SURE YOU ARE IN YOUR TEST DATABASE.
  2. Find the option name “siteurl”.
  3. Click the pencil on the siteurl line to edit the information.
  4. Change the siteurl to your test site.
Step 5: Update your wp-config file
  1. In FTP, navigate to the root of your TEST WordPress installation.  In our example this would be www.mytestsite.com/blog.
  2. Open the file called wp-config.php
  3. Change the values for DB_NAME, DB_USER, and DB_PASSWORD to your test database information.
Step 6: Validate
  1. Visit www.mytestsite.com/blog/wp-admin and log into your test site.  You will log in with the same username and password as your production site.
  2. Verify that your test site is visible at www.mytestsite.com/blog.

Voila!  A perfect copy of your blog.  Use your test site to edit your theme, install new plugins to play with, develop new functionality, test upgrades of WordPress or plugins, etc before applying the changes in production.

A few notes:

  • If you aren’t on WordPress, but instead have an HTML website, you should still have a test site.  Simply FTP the files from your web server to your computer, and then FTP back up to your new domain.
  • Your web hosting provider should also allow you to easily password-protect your test site’s domain.
  • You should also read the WordPress Codex articles about Restoring Your Database From Backup and phpMyAdmin.

Edited To Add: See comments below for some reasons why you need a test site – this can include changes to your WP theme, or testing out plugins and new functionality, and creating new page templates – and also a shortcut method that doesn’t involve a whole backup of your production site.

Chime In

Images In Blog Posts: The Technical Side


We’ve talked about the legalities and etiquette of images in your blog posts.  Today, let’s chat about some of the tech tips for blog images.

Tech Tips for Images in Blog Posts

Size matters

High resolution images are a no-no.  Not only will it kill the speed of your site to host high resolution images, but it’s also bad blogging etiquette. Use WordPress’s built-in Media resizing functionality to help you out with resizing.  Under Settings -> Media you can supply a thumbnail size, a medium size (I use this for vertical images) and a large size (horizontal).  As you upload photos, WordPress will automatically create copies of the image resized to each of your specified dimensions.

Because most people are viewing your site on a widescreen monitor, portrait/vertical photos should be sized to about half of the width of landscape/horizontal photos.  This will help to keep the file sizes smaller, as well as keep each image within the viewable area of everyone’s screen.  For aesthetic reasons, this is why many blogs choose to “pair up” verticals in their posts.

What’s in a name?

A lot actually.  Search engines can’t “see” images, they simply recognize the caption (aka alt text), title, and image name and read those to index the image.  Name your images something descriptive and WordPress will automatically fill in the alt text with your image name.

When deciding on a file name, put yourself in the shoes of the searcher. “Juli and Jon Wedding.jpg” likely won’t produce any search hits. But “Yellow Sunflower Bouquet.jpg” might. Your alt text will also become your default Pinterest text when a reader pins an image from your site, so choose wisely!

A helpful hint

Using a Content Delivery Network (“CDN”) helps to speed up the delivery of images. A CDN makes copies of your images (along with stylesheets, javascript files, and the like) and places them on their servers worldwide. This way, your visitors are served up a file from the location closest to them. Cloudflare is a great choice for starting out with a CDN, as they have a free plan. WordPress’ Jetpack plugin also includes the option to use their Photon service.

In future posts, we’ll cover more advanced WordPress image issues, such as custom fields for image photography credits, media tagging, and the like. What other image tips and tricks do you have to share?

Chime In

What Is WordPress Anyway?


Although there are several blogging platforms available to you, we’re mainly going to discuss the technology and coding behind just one of them here on Edit and Post, and that is WordPress. WordPress is currently the most flexible and powerful option out there and it’s the platform I use for Edit and Post, Entouriste and Elizabeth Anne Designs.

What is WordPress

What is WordPress, anyway?

WordPress is an open-source content management system.  Open-source means that the code for the software is freely provided and can be altered and built upon by anyone.  Why is this cool? Because that means there are thousands upon thousands of people working every day to enhance WordPress functionality by creating themes and plugins to be used with the basic code (we’ll chat more about themes and plugins soon!).

WordPress requires a MySQL database to run, along with a web server.  Your WordPress database is made up of several tables.  Each table holds a specific element of data, such as your posts, comments, and settings.  Your web server holds your image files, theme files, plugins, and WordPress admin files.  You can think about things this way: if you upload it, it goes on your web server.  If you write it or input it, it goes into your database.

How do the web server and database talk?

They use a language called PHP.  Every time WordPress needs to “get” something from the database, a PHP script is run.  There are several default PHP functions in WordPress, and you can also create your own.

PHP = “get”
Want to get the post title? <?php the_title(); ?>
Want to get the content? <?php the_content(); ?>
Want to get the author? <?php the_author(); ?>

Depending on the data you are gathering, the WordPress PHP function may default to “get and display” or simply “get”.  Both are useful!  We’ll talk about PHP a lot more in the future, but for now, just remember that PHP is how WordPress gets data from the database.

How does the PHP function turn into results?

After the web server has received data from the database, it turns it into HTML.  HTML is the language that your browser uses to display a website.  An example:

In WordPress, I have a PHP function that says: <?php the_title(); ?>

Once my web server has processed that script for the post you’re currently reading, the database will return: What Is WordPress Anyway?

The web server then displays to you: What Is WordPress Anyway?

You never see the PHP script and neither does Chrome, Firefox, Safari, IE or whatever other browser you are using!

How do I style those results?

You make HTML look pretty using a language called CSS, which stands for cascading style sheets.

CSS tells your browser how to format things (fonts, colors, margins, spacing, etc).  CSS is very flexible, and you can style different elements of your page with different CSS markup.

Where do I put my PHP and CSS code?

Your PHP and CSS code goes inside your WordPress theme.  Simply put, your theme is how you want your WordPress data displayed to the world.  Several themes are installed with WordPress, and customizing your own theme is something that we’ll talk about in detail.

In the upcoming series of posts, we’re going to cover server needs, hosting basics, and the installation and basic configuration of WordPress.

Chime In

TO TOP