Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

WordPress Quick Start Guide

Get Set Up

The New To WordPress - Where to Start article accompanies this section, though it contains duplicate information and should be merged with this section.

Advantages of Self-Hosted WordPress Blogs

A self-hosted WordPress blog has a number of advantages over freely hosted blogs. With a self-hosted WordPress blog, you have complete control over your code, so you can implement any theme, modify it entirely, or create your own. You can add any plugin you want, and then hack the code. The application's code is completely open, allowing you total access to modify, tweak, or explore what you want.

There's much in store for the non-professional and non-technical blogger also, whose writing will revolve around casual and professional blogging without bothering about details how the website functions.

WordPress has a large community of enthusiastic bloggers who help each other in forums, create and share themes and plugins, and help move the software forward with new features and better design. With such freedom, what you can do with a WordPress blog can be a bit overwhelming. The WordPress Codex (the wiki manual for WordPress) has hundreds of pages and can be daunting in scope.

The intent of this WordPress Quick Start Guide is to get you up and running with WordPress and give you a brief overview of the most important concepts and techniques. It covers the most common setup tasks you need to technically launch, configure, and manage your blog. It then lays down some concepts for more advanced theme modification.

Note: WordPress.org differs from WordPress.com in a fundamental way. WordPress.org provides WordPress software that you can download and install on the server space you rent from a web host. In contrast, WordPress.com provides free hosting for your WordPress blog, but restricts the themes and plugins you can implement. With WordPress.com, you have to pay extra to modify your stylesheet, and you can't display ads or manipulate any of the code. All the media you store on a WordPress.com blog by uploading is saved on WordPress's servers, so you're not in full control here either. (For more information on the difference, see WordPress.com Versus WordPress.org.) Everything in this guide relates to self-hosted WordPress blogs.

Become Familiar with FTP

One tool you'll need to manage your WordPress files is an FTP program, such as FileZilla. Recent WordPress functional enhancements reduced the chance of FTP program using but if your web host doesn't provide any auto-installers, you'll need an FTP program to install your blog.

FileZilla is a simple program. All it requires is your web address, username, and password to connect to your web host. When you connect, the remote host's files appear in the right column, while your local files appear in the left column. You transfer files or folder from your local host to the remote host by dragging the files to the remote host column. After you enter your FTP details once, use drop-down arrow next to the Quick Connect button to connect immediately.

FTP programs like FileZilla can support you further. Through them, you can upload files in bulk. To show them up in your media library though, you'll need plugins, like the plugin called Add From Server.

More Information:

Install WordPress on Your Web Host

You need a web host that has PHP and MySQL/MariaDB. To make the installation of WordPress as simple as possible, make sure your web host has cPanel (or something similar). In my experience, BlueHost probably has the best support of any web host, and it has the easiest auto-installer: Simple Scripts. After you sign up with a web host, navigate to the cPanel (or the equivalent) and look for Simple Scripts, Fantastico, or some other auto-installer for WordPress. If there isn't an auto-installer, you have to install WordPress manually following the "famous 5 minute installation" instructions, which are fairly simple. See the resources below for instructions on the different installation methods.

To install WordPress on a Web host:

  1. Sign up for a web host plan (for example, at BlueHost.com).
  2. Log into your cPanel by going to http://yourdomain.com/cpanel.
  3. Click the Simple Scripts feature (or, alternatively, the Fantastico feature).
  4. If no auto-installer exists, follow the steps for the 5 minute manual installation.
  5. Install a WordPress blog.

Directories of Files Uploaded

The WordPress installation arranges files in three main folders (wp-admin, wp-content, and wp-includes). It also installs loose files in the root folder. Most of the time, when you work with your WordPress files through FTP, you'll be uploading content to the wp-content folder.

Note:When you connect to your remote host, you may have to go into the public_html or www folder to see the WordPress files. Both folders open the door to your WordPress content. The folders simply mirror each other to deliver the same results when users go to either http://www.yourdomain.com or http://yourdomain.com.

The wp-content folder has two important subfolders: plugins and themes. When you install a plugin or theme from Administration Screens, all required files are stored in these folders. Also, any images or medias you upload when writing a post in WordPress are stored in the wp-content/uploads folder.

More Information:

Explore Your New WordPress Blog

Once you have WordPress installed, you should spend some time exploring it. To log in to your newly installed blog, go to http://yourblogdomain.com/wp-admin and enter the username and password you used when you set up the site.

After logging in, you'll see the Administration Screens that you use to write posts and pages, upload images and manage WordPress. Explore left side menu to see the different functions they perform.

More Information:

Configure Basic Settings

You need to configure some basic settings in your blog, such as the title, tagline, time zone, and your name. Click the Settings on the left side menu, and then browse through the available submenus -- General, Writing, Reading, Discussion, Media and Permalinks. Select the options you want.

As you're configuring your settings, be sure to enable permalinks and allow comments without moderation if you wish. Permalinks make your URLs intelligible names that reflect the title of your post, rather than something like ?p=123. You may configure Comments. By default, Comment author must have a previously approved comment.

To configure your settings, at the very least do the following:

  1. Enable permalinks by going to Settings > Permalinks. Select the Day and Name option (if you select another option, it's more difficult to set your page URLs).
  2. If you need, enable comments to appear immediately by going to Settings > Discussion. In the "Before a comment appears" section, turn off all check boxes.
  3. Set the blog title and tagline by going to Settings > General. Usually the blog title and tagline automatically appear in your blog's header.
  4. Set the correct time zone by going to Settings > General and selecting the appropriate city or UTC number in the Timezone section.

More Information:

Import Your Content from Blogger or Elsewhere

If you're transitioning to WordPress from another blog platform, you can import your old content. Go to Tools > Import and select the specific software you're importing from. Almost all blogs can be imported into WordPress.

More Information:

Create Content

Write a Post

Posts are the regular blog entries you write that appear on your home page. You write posts by selecting New from Toolbar or Posts > Add New from left side menu. Complete the fields and information, select or create a category, and then click the Publish button. Writing posts is the most common activity you'll do in the Administration Screens. When you write blog posts, keep your paragraphs short, use subheadings, include images, and avoid a stuffy tone. To insert a "Read more ..." tag, click the Read More button on the toolbar.

More Information:

Create a Page

Pages are for content such as "About Me," "Contact Me," etc. Pages live outside of the normal blog chronology, aren't included in your RSS feed. They're often used to present information about yourself or your site that is somehow timeless -- information that is always applicable. You can use Pages to organize and manage any amount of content. Other examples of common pages include Copyright, Legal Information, Reprint Permissions, Company Information, and Accessibility Statement. (By the way, it's a good idea to always have an About page and a Contact page -- see this advice from Lorelle.)

More Information:

Make Categories for Your Posts

Categories help make sense of the hundreds of posts you'll be writing. By assigning the posts into different categories, you can allow readers to browse archives of only that category. To create a category, click the +Add New Category link in the Categories section in the right side menu. You can select multiple categories for the same posts. To manage your categories, go to Posts > Categories.

Additionally, through categories, you can manipulate your posts in advanced ways, such as excluding certain categories from your home page, or specifying where certain categories should appear. This is a common technique for magazine-style layouts, where you have different sections on the home page and you want posts from those categories to always appear in those sections.

You can also give each category its own unique layout and design. For example, when you have category 'Latest News' whose slug is 'news', you copy the content of your archive.php file, rename it to category-news.php, and then modify the file (such as removing the sidebar, or changing the header), the archives for that category 'Latest News' will use the category-news.php file rather than archive.php file.

More Information:

Add Tags to Your Posts

Tags are like micro-categories or index keywords for your posts. Your site should probably only have 7-12 categories, but you can have hundreds of tags. Clicking a tag name below your post will show all posts with the same tag, helping readers find similar content (most readers arrive at your site through searches for a specific topic). You add tags to your posts by typing the tag names in the Tags section in the right side menu. You can also manage your tags by going to Posts > Tags.

If tags are enabled in your theme, you will usually see them below the published post. If not, you can add a php tag to make it appear. Prepar Child Theme of current theme and copy single.php from parent theme. You'll see the code that generates your posts. Add <?php the_tags(); ?> to this file where you want the tags to appear (usually after the <?php the_content ?> tag, which generates your post content).

More Information:

Edit a Page or Post

One of the neat things about WordPress is that you can edit any post or page by clicking the Edit link that usually appears at the bottom or top of each page. You can also edit your posts and pages from the Posts menu or Pages menu of Administration Screens, but sometimes it's easier to just navigate to the content you want to edit and click Edit.

To edit a page or post:

  1. First log in to your site by going to http://yourdomain/wp-admin.
  2. Click the Visit Site link under the site name at the top of the page to return to your site.
  3. Navigate to the page or post you want to edit.
  4. Click the Edit link that appears on the page or post.
  5. Make your changes, and then click Update.

If the Edit link doesn't appear, it's because your theme designer has omitted it from the code. You can add it by creating Child Theme and placing the single.php file. Add the following code after the <?php the_content(); ?>:

<?php edit_post_link('Edit', '', ' | '); ?> 

Now when you view a post, an Edit link appears at the bottom, after the content. If you log out, the Edit link is hidden.

More Information:

Style Your Site

Change Your Theme

A WordPress Theme is a collection of files that work together to produce a graphical interface with an underlying unifying design for a weblog. These files are called template files. A Theme modifies the way the site is displayed, without modifying the underlying software. Themes may include customized template files, image files (*.jpg, *.gif), style sheets (*.css), custom Pages, as well as any necessary code files (*.php).

The WordPress Theme Directory is the official site for WordPress Themes which have been checked and inspected, and are free for downloading. The site features the ability to search by type and style, and offers a demonstration of the page view elements of the Theme.

You can install Themes directly to your blog from Appearance Themes Screen.

  1. Log in to the WordPress Administration Screens.
  2. Select the Appearance screen, then Themes.
  3. Select Add New.
  4. Either use the Search or Filter options to locate a Theme you would like to use.
  5. Click on the Preview button to preview the Theme or the Install buttonto install the Theme to your blog, and click Activate link to activate the theme.

After installing a new theme, you may need to configure the sidebar, page navigation, header and so on. Go to Appearance > Customize to customize your site. If you want to modify your current Theme for your own use, consider creating a Child Theme. When you customize a theme, always make sure it looks good in multiple browsers such as Internet Explorer, Firefox, Safari and so on. If you have a question about a theme, try visiting the theme's site first. If that doesn't work, go to the themes and templates section of the WordPress forum.

More Information:

Modify Your Sidebar

Themes usually have at least 1 or 2 sidebars. Sidebars are the narrow columns to the left or right of your blog posts. Each section in the sidebar is known as a "Widget" that you can move up or down. Sidebars commonly list your pages, contact information, top posts, RSS feed, some about text, links, and ads.

To configure your sidebar:

  1. Go to Apperance > Customize to open the Customizer. Although you can onfigure Widgets via Appearance > Widgets, you have to save it to confirm the new appearance. Customizer can show the preview your changes in live without saving.
  2. Click the Widget menu in the Customizer to access to the Widget Customize Screen.
  3. Click the down arrow of Widget Area to list the already registered Widgets.
  4. Click Add a Widget button at the bottom of sidebar. It shows the list of available widgets.
  5. Click a widget you want to add. The widgets should be added in the sidebar.
  6. Preview your site and you should see the content from your new Widget.
  7. To arrange the Widgets within the Sidebar, drag and drop the widgets in the order you want or click Reorder link and click up arrow and down allow of each widget and click Done after the arrange operation.
  8. To customize the Widget features, click the down arrow in the right to expand the Widget's interface.
  9. To remove the widget, click Remove from Widget's interface in above step.

More Information:

Customize Your Header Image or Background

One of the most common ways you'll want to customize your theme is by changing the banner image. From Customizer, you can change header image, background image, color of site. Go to Apperance > Customize to open the Customizer, and select each menus.

More Information:

Configure How Your Pages Appear

Different themes show pages in different ways. Themes that show a few posts with Featured images in the top page will pick up from probably your recent posts. Other themes generate your list of pages in the sidebar. Other themes require you to manually type the page IDs.

You should know several things about the ordering of pages. If a list of pages (that you created) automatically appear on your site, you can change their order through the Order field in the Page Attributes section.

To change the page order:

  1. Go to Pages > All Pages from Administration Screens.
  2. Click the page you want.
  3. In the Order field of the Page Attributes secion in the right side menu, set the page order by typing 1, 2, 3, and so on. A page with an order of 1 appears before a page with an order of 2.
  4. Click Update.

Tip: If you're listing your pages in your sidebar, the Pages widget has Sort by and Exclude options that allow you to define the way the pages are sorted and what pages are excluded.


RSS Feed

One of the most important features of your site is your RSS feed, which subscribers will use to add you to their feedreaders. All WordPress blogs have RSS feeds by default, and even categories and specific posts have RSS feeds. You can see your feed by adding /feed after your domain. For example, if http://idratherbewriting.com is my domain, then http://idratherbewriting.com/feed is my RSS feed.

More Information:

Add More Functionality

Install a Plugin

WordPress plugins are scripts you install to extend the functionality of your blog. For example, one common plugin is Subscribe to Comments Reloaded. When added, it allows readers to receive notification of follow-up comments for posts they've commented on. WordPress doesn’t ship with this feature already included — you must install it via a plugin.

You install a plugin in the same way you install a theme. The WordPress Plugin Directory is the official site for WordPress Plugins which are considered thoroughly tested and "safe". You can install Plugins directory to your WordPress from Plugins Add New Screen.

To install a plugin:

  1. Log in to the WordPress Administration Screens.
  2. Select Plugins > Add New to open the Plugins Add New Screen.
  3. Either use the Search or Filter options to locate a Plugin you would like to use.
  4. Click Install Now button
  5. Click Activate Plugin
  6. Configure the specific plugin settings as described in the readme.txt file, or refer link menus of the installed plugin at Plugins > Installed Plugins. If the plugin is a widget, go to Design > Widgets and add the widget to your sidebar.

More Information:

Activate Akismet to Stop Spam

Spam robots will flood your posts with spam unless you take some protections and activate Akismet. WordPress includes Akismet by default, but you have to first activate the plugin and then enter an API key.

To use the Akismet plugin:

  1. Click the Plugins > Installed Plugins menu.
  2. Click Activate link under the Akismet Plugin.
  3. Click Activate your Akismet account
  4. Click Get your API key. It will open Akismet's web site
  5. Click Get An Akismet API Key
  6. If you have Wordpress.com account, enter it from "I already have a WordPress.com account!" link. If not, enter E-mail Address, Username, Password and click Sign Up.
  7. Selec your subscription type and enter payment information if that is required, and click Continue. API Key will be displayed at the last panel.
  8. Enter API key in the Manual enter an API key box at the above Step 4 and click Use this key. If the key is accepted, the prompt to enter your API key disappears and Akismet is activated.

You can see how much spam Akismet stops by going to Comments menu and clicking Spam link. It's a good idea to periodically check the spam to make sure no legitimate comments land in there. If your blog is brand new, you may not get much comment spam. But the more hits your blog gets, the more comment spam it attracts.

Some people make the rule of requiring users to log in to comment, or they moderate all comments before they appear. In general, it's easier to delete the occasional comment spam than to approve each comment.

More Information:

Create a Regular Database Backup

Every post and page you write in WordPress is stored in a MySQL/MariaDB database. There aren't separate files for each page or post. It's important to regularly back up your database in case something goes wrong (such as with a rogue plugin or a misguided upgrade attempt). You can manually back up your database by using a tool like phpmyadmin, but it's much easier to simply use the Plugins.

Go to the WordPress Plugin Directory, search or filter them by 'backup', and pick up the Plugin according to your preference.

More Information:

Include a Contact Form

Readers should be able to contact you in two ways: (1) by leaving a comment under a post, and (2) by contacting you through an email address or contact form. Several plugins provide immediate contact forms you can implement on your site. This way when a literary agent contacts you for a book deal, or a conference organizer wants to ask you to deliver the keynote, the person can actually contact you.

Go to the WordPress Plugin Directory, search or filter them by 'contact' or 'form' or both.

Install Other Needed Plugins

WordPress has hundreds of cool plugins that add functionality to your blog. Go to WordPress Plugin Directory. There are plugins for almost everything you can imagine.

Note: Do not install the plugin if below messages are displayed at the top of Plugin page:

This plugin hasn’t been updated in over 1 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Search other alternative Plugins.

Also do not install Plugins from other than WordPress Plugin Directory without understand the risk of it.


Understand the Code More

Understand A Little Bit About Template Tags (PHP)

The code in your theme's files consists of XHTML and PHP tags. PHP is the scripting language that WordPress uses to pull information from the database, where your blog's data is stored. WordPress uses different PHP tags to call different types of information from the database. When the user clicks on a page that has a PHP tag, WordPress dynamically calls the data from the database and displays it.

PHP tags begin with a <?php and end with a ?>. The text between this tag is the function. For example, the following PHP tag shows all your categories, but with a specific parameter to exclude categories 10, 11, and 12:

<?php wp_list_categories('exclude=10,11,12'); ?>

WordPress has many different template tags similar to wp_list_categories. You can view all the different template tags here. Each tag calls different information and allows you to pass different parameters in the parentheses (). Read up on a tag to see exactly what it calls and how it's used.

More Information:

Modify Your Theme's Appearance

Your blog's style -- the colors, the fonts, the widths, and so on -- is mainly styled by your theme's stylesheet. To make adjustments to your blog's style, create Child Theme of your current theme and edit style.css. Since themes are individually created by a wide variety of people, stylesheets from one theme to the next all look a bit different (but all conform to CSS standards). The theme designers create styles to define different sections, but one designer's style names may vary with that of another designer's names. Additionally, some use CSS shorthand and compress the info into a small space, while others break out each of the selector's attributes onto a different line.

To find the name of a style, you can use the browser's inspector tool launched by

  • Internet Explorer: Press F12
  • Firefox and Chrome: Right Click and select Inspect Element
  • Safari: Click Safari > System Preferences, click Advanced tab, and turn on "Show Develop menu in menu bar". Then Right Click and select Inspect Element

Identify the CSS of a specific element, and then go into your stylesheet to modify that element. The more familiar you are with CSS, the easier it will be to modify the styles. See W3schools' tutorial on CSS for a good foundation.

Understand Your Theme's Files

Each theme has a collection of files with names like index.php, archive.php, single.php, and so on. WordPress dynamically pulls together these files based on what the user clicks. For example, if the user clicks your blog's home page, the home.php or index.php file is used (WordPress first looks for home.php first; if no home.php exists, it looks for index.php).

Additionally, the home.php or index.php file includes several other files, namely header.php, footer.php, and sidebar.php. While the files exist separately, they are pulled into one file through include statements in the home.php or index.php file. If you remove the <?php get_sidebar(); ?> include tag from your index.php file, the sidebar won't show anymore.

It's important to know which user queries call which templates. The following are the rough flows of theme templates used when a user clicks something on your blog. For the complete infomation, refer Template Hierarchy.

  • If a user clicks your blog's home page, the home.php file is used. If the home.php file doesn't exist, index.php is called.
  • If a user clicks a post title, single.php file is used.
  • If a user clicks a category archive, WordPress first looks to see if any category archive templates are available for that category (e.g., category-25.php, where 25 is the ID number of the category). If no category template is available, archive.php is used.
  • If a user clicks a page, the page.php template is used. (If you've created a unique page template, you can select it from the Page Template section when writing the page. WordPress will then use that specific page template for that page.)
  • If a user clicks a tag, the tag.php template is used.
  • If there's a bad link and the database returns an error, the 404.php template is used.
  • If an author name is clicked, the author.php template is used.
  • If a user searches for something, the results are displayed on the search.php page.

Some themes have more template files than others. When a template file is absent or simply not used, usually the index.php file substitutes. Also, sometimes the index.php has some conditional statements that show different code based on different queries, so your blog may actually have different views for the home page versus a single post, but the differences are defined within the same file through conditional statements.

More Information:

Recognize the Loop

As you explore the code, one thing you should learn to recognize is "the Loop." The Loop is a section of PHP code that tells WordPress to display the latest posts from the database on your blog. It's an important piece of code because the appearance of each post on your blog is controlled by what's inside the Loop.

For example, on many blogs, there's no byline because the blog is written by a single author. But on group blogs, you need an author byline beneath each post, something that says By Tom Johnson, or whoever the post author is. Yet the author tag won't appear in every post if it's not included inside the Loop. To show the author tag on every post, you have to add <?php the_author(); ?> inside the Loop.

To see the loop, go to any theme's directory such as wp-content/themes/twentysixteen and open the single.php file or index.php file. The Loop begins with the code such as following:

<?php
// Start the loop.
while ( have_posts() ) : the_post();

And then usually some template tags come after this line, so that your post title, post content, the time, and comments appear. You would add the author tag somewhere between the start and end of the Loop, depending on where you want the author byline displayed. The end of the Loop is the code such as following:

// If no content, include the "No posts found" template.
else :
    get_template_part( 'template-parts/content', 'none' );

endif;
?>

You may also want to alter the way the other post content appears. So it's good to be aware of the Loop.

Additionally, if you're playing around with the code and you alter the Loop's start or end tags, your content won't display at all (and you'll probably start hyperventilating). If you recognize the Loop, you can easily fix the code.

Finally, some plugins will require that you add a certain line of code "inside the Loop." When that's the case, you open up your index.php, archive.php, or single.php file or any other file that has the loop, and insert the code between the starting or ending point of the Loop.

More Information:

Learn How to Upgrade Your Blog Software

You should always update WordPress to the latest version. When a new version of WordPress is available you will receive an update message in your Administration Screens. To update WordPress, click the link in this message.

This signle click update feature will be available not only the WordPress program but also Themes in WordPress Theme Directory and Plugins in WordPress Plugin Directory. This is one of the reason why you should stick to official Theme and Plugin.

Note: You don’t have to lift a finger to apply minor and security updates. Most sites are now able to automatically apply these updates in the background. If your site is capable of one-click updates without entering FTP credentials, then your site should be able to update from 4.3 to 4.3.1, etc. You’ll still need to click "Update Now" for major feature releases such as 4.3 to 4.4.

More Information:


Learn How to Get Help

One thing to remember with WordPress is that it's an open source project, with many people from different backgrounds and countries contributing themes, plugins, and other code. As such, sometimes the plugins and themes break, or are incompatible, or have other issues. At some point, you may need help with WordPress, either because your theme doesn't look right, or because a plugin is causing an error. If you need help, use the following resources:

  • WordPress Codex. This is the core wiki manual where you'll find most information related to WordPress. The Codex is a bit daunting in scope, some of the information is outdated, and it's not always explained with the graphics and clarity of commercial applications. Still, it's a powerful resource. This is where you can really expand your knowledge of WordPress.
  • WordPress Support Forums You can pose questions and hope that forum volunteers help you. The forums also contain a rich repository of questions already answered. Unfortunately, the forums don't offer email notification for follow-up responses. You can check responses to your questions by clicking the View Your Profile link in the upper-right (or by subscribing to the RSS feed of your question). Searching the forums is an excellent way to find answers to your questions.

Note: One must-know tip is how to search both the forums and Codex. Rather than using the built-in search feature, do a site-search using Google. Go to Google and type something like site:wordpress.org upgrading wordpress. You'll find that searching through Google yields much better results than using the built-in search features in the Codex or forums.

More Information: