How to Create a Blog on Cloudways
Last modified: February 19, 2021
If you’re looking to create a blog on Cloudways, then you need to know how to use code. These simple instructions allow you to create a blog on Cloudways that uses the simple and effective WordPress system.
* This button will show the rest of the post and open up an offer from a vendor
Why do you Need a Blog?
Blogs are simply a very important marketing tool. They’re visited more by customers than any other landing page on most websites. They contain important information like advice, news, how-tos and more, that customers actively search for on the internet, just like you did to get to this article.
Customers can then use that knowledge to learn more about the brand and whether it might have some value in helping them solve a problem. For example, if someone wants to know about fixing a broken pipe, they might enter that into a search term. A plumbing company might have written an article on that to help people with that. The searcher sees the instructions and then realises that the job is too hard for them, so they call the plumber out.
Studies have shown that a blog increases page rank on Google and other search engines as well as increase traffic. They can also be used to improve conversions and inbound links.
So these are the steps that you need to add a blog to your website.
Step 1 – Create a WordPress blog template file
The first step is to use Page Templates to generate a custom blog page in WordPress. This is done by creating a new file in the Theme folder. The name of the new folder should be page-blog.php. Within the file you should enter the following code:
<?php /* Template Name: Blog Page */ ?>
Within the WP-admin there should be a ‘template’ dropdown menu that has Add New Page under the Page Attributes options. Now you can create a new page on your WordPress website and name this ‘Blog’. You should select the Template as ‘Blog Page’.
Step 2 – Make the Settings so the Loop Loads the Latest Blog Posts
In the page-blog.php file, we need to set the WordPress loop to default. This will show the latest blog posts first and the oldest posts last. To do this you need to access your page-blog.php file and install this code into it.
<?php /* Template Name: Blog Page */ ?> <?php get_header(); ?> <div class="padding"> <div class="box-bg margin-bot"> <div class="wrapper"> <?php $the_query = new WP_Query( 'showposts=5' ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <li><?php the_content(); ?></li> <?php endwhile;?> </div> </div> </div> <?php get_footer(); ?>
This will set a single page where all the posts will be displayed with the latest at the tops. You can play around with the design of the posts at another time. Or ask a developer to help you adjust your theme for the new blog page.
Step 3: Setting up Single Post Page
Now you need to create a single post page that shows a post in its entirety on a single page. By default, WordPress will load the single.php to display any posts if they’ve been uploaded.
To complete this step, you need to create a single.php and in this file and run a loop to display all the required posts. To do this, enter this code:
<?php get_header(); ?> <div class="padding"> <div class="box-bg margin-bot"> <div class="wrapper"> <!-- WordPress Loop --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="entry <?php if(is_home() && $post==$posts && !is_paged()) echo ' firstpost';?>"> <h3 class="entrytitle" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <p class="blogdate"> <?php the_time('F jS') ?>, <?php the_time('Y') ?></p> <div> <?php the_content(__('Read more'));?> </div> <?php trackback_rdf(); ?> </div> <?php comments_template(); // Get comments.php template ?> <?php endwhile; else: ?> <p> <?php _e('Sorry, no posts matched your criteria.'); ?> </p> <?php endif; ?> <!-- End WordPress Loop --> </div> </div> <!-- end middle content area --> <?php get_footer(); ?> </div> </div> </div>
Final Word: How to Create a Blog on Cloudways
The above explained how you can create a blog on Cloudways. However, a better way is to use Cloudways to host a WordPress website. This automatically includes lots of blog functionality, like a caching plugin called Breeze, and allows you to promote your website across the world.