15 Basic WordPress Hacks for Bloggers

Whether you’re a blogger or a developer managing content for a website, you need to know some clever hacks to make the most out of your WordPress experience.

WordPress is the top choice for Content Management Systems for almost 30% of websites on the internet. WordPress is a great CMS choice for bloggers which helps them boost their blog page. You’ll find a lot of tutorials and tips online to boost your blog and help it reach its maximum potential.

Most people are still not familiarized with certain hacks to boost their productivity. These certain hacks can add other great, untapped functions in WordPress.

Here are some basic WordPress hacks which every blogger should know. It includes codes and instructions on how to facilitate each wordpress function.

1. How to disable post revisions on WordPress

Add this code to wp-config.php file to limit and disable revisions for the article.

define('AUTOSAVE_INTERVAL', 120 ); // seconds
define('WP_POST_REVISIONS', false );

2. How to Add another footer on WordPress

Not all websites support widgets in the footer. Learn how to add footer and add multiple ones.

  • Create Child Theme directory and files
  • Add the file for the WordPress footer widget area
  • Add Code to the Child Theme’s Files to create the widget
/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    
 Description:  Twenty Fifteen Child Theme
 Author:     
 Author URI:  
 Template:     twentyfifteen
 Version:      1.0.0
 Tags:         light, one-column, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/
  • Then you can add the footer in the widget area
/**
 * Register footer widget area.
 *
 * @since Twenty Fifteen Child 1.0
 *
 * @link https://codex.wordpress.org/Function_Reference/register_sidebar
 */
function twentyfifteen_child_widgets_init() {

register_sidebar( array(
    'name'          => __( 'Footer Widgets', 'twenty-fifteen-child' ),
    'id'            => 'sidebar-2',
    'description'   => __( 'Add widgets here to appear in your footer area.', 'twenty-fifteen-child' ),
    'before_widget' => '

‘, ‘after_widget’ => ‘

‘, ‘before_title’ => ‘

‘, ‘after_title’ => ‘

‘, ) ); } add_action( ‘widgets_init’, ‘twentyfifteen_child_widgets_init’ )

3. How to add a custom page in WordPress

Just add this code on top of the custom HTML page:

  • After you add the code, save the html page as squeeze.php and upload it to your current theme folder
  • After you add it, you can now create a new page and see which template can be included in the Page Attributes’.

4. How to add an infinite scroll on WordPress

You need to install the Jetpack plugin. This enables the infinite scroll feature and you can embed this code to your functions file.

 add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => 'page',
) );

5. How to customize log in page on WordPress

  • Open your name directory (../wp-content/themes/your-theme-name) and add a folder called “login”.
  • Create a CSS file inside the login folder and name it custom-login-styles.css
  • Add this code to your functions.php file
function my_custom_login() {
echo '';
}
add_action('login_head', 'my_custom_login');

After you customize it on your CSS, you can now have your own personalized design of Login Page.

6. How to add a customized CSS file on WordPress?

Just add this code to create your own customized CSS theme:

function custom_style_sheet() {
wp_enqueue_style( 'custom-styling', get_stylesheet_directory_uri() . '/custom.css' );
}
add_action('wp_enqueue_scripts', 'custom_style_sheet');

Remember to make sure the new CSS file is located on the same directory of the main CSS file.

7. How to Install a child theme on WordPress?

Paste this code:

/*
Theme Name: Child Theme Name
Template: parent theme
*/
@import url("../parenttheme/style.css");

Important note: Change the to the actual name of the parent theme and call the parent theme’s CSS file within your child theme’s CSS file. Do not use curly quotes, use normal quotes.

8. How to Use normal quotes instead of curly quotes on WordPress

WordPress turns normal quotes to smart codes if you’re sharing a snippet. Here’s how to use normal quotes and not the curly quotes. You have to disable the feature and enter the code to your functions.php file.

remove_filter('the_content', 'wptexturize');

9. How to Display random image header on wordpress?

If you are a person who would love to display random image headers on your blog, this trick is for you.
Name your image 1.jpg, 2.jpg, 3.jpg, and so on. Upload those images to images folder inside your theme directory. Then, paste the following code to the header file.

Important: Replace Path_to_image_folder with the actual path.

10. How to Delete existing post revisions on WordPress?

Do you want to delete all the existing revisions saved in your database and manage all other revisions? Just do the following SQL query on your PHPMyAdmin:

DELETE FROM wp_posts WHERE post_type = 'revision';

11. How to add a feature box on WordPress?

WordPress also has a featured box in the body text/content. Just enter the code below.

function make_yellowbox($atts, $content = null) {
return '

‘ . do_shortcode($content) . ‘

‘; } add_shortcode(‘yellowbox’, ‘make_yellowbox’);

If the featured box is inside your post and you want it to be emphasized, you can add the above code to the functions file of the theme.

This code lets you add a featured box in yellow.

[yellowbox]Your featured content here[/yellowbox]

12. How to show related posts without using a plug-in on WordPress

Just insert this code below:

No related posts found!

13. How to erase thousands of spam instantly on WordPress

There are a lot of spam comments which are not filtered out by the spam filter and goes to your list of “awaiting moderation” comments. However, it may be time consuming to moderate and delete one by one.

Just follow these simple steps below:

Log in to phpMyAdmin, select your website’s database, click SQL and paste the code given below in the SQL command window.

; DELETE from wp_comments WHERE comment_approved = '0'

This hack is very efficient and saves you time!

14. How to Separate both comments and trackbacks on WordPress

WordPress combines comments and trackbacks together by default. If you want your website to be more organized, you can separate them.

Follow these instructions:

    • Find the code below in the comments.php file.
Step 1: Find the below code in the 

Paste the below code after it.


Step 2: Then, look for the below code

    • Paste this code before the above one
Step 3: Then, look for the following code

Paste the below code before it

Trackbacks

15. How to Increase your PHP memory on WordPress?

Sometimes when you active a new plugin, you will find that there can be an error of memory exhaustion. To solve this, you can just simply add this code to the wp-config.php file

define('WP_MEMORY_LIMIT', '64M');

This code will increase your memory limit to 64M and just change it depending on your server capacity.

Did you find the above article useful? Share your hacks in the comments below.

About the Author

Sande Kennedy is the founder and Editor in Chief of SandeKennedy.co.ke & Kenyans247.co.ke He is a Kenyan-based Internetprenuer,blogger Political Activist & informer who has an interest in politics, governance, corporate-fraud and human-interest. Kindly drop me a note if you feel aggrieved on any matter that you would want to be highlighted  Twitter: @nyosake , Instagram: @itssandekennedy WhatsApp: +254791890826 Read More about me here