SpyreStudios

Web Design and Development Magazine

  • Design
  • Showcase
  • Inspirational
  • Tutorials
  • CSS
  • Resources
  • Tools
  • UX
  • More
    • Mobile
    • Usability
    • HTML5
    • Business
    • Freebies
    • Giveaway
    • About SpyreStudios
    • Advertise On SpyreStudios
    • Get In Touch With Us

5 Most Clever WordPress Tweaks to Improve Your Site (Without Plugins)

September 20, 2018 by Christopher Jan Benitez

wordpress tweaks

WordPress is one of the best CMS out there for a number of reasons. Aside from being flexible and highly customizable, you can supercharge it using powerful plugins. Regardless of your goals for your website, you can be sure there’s a plugin for that.

However, it’s always better to forego plugins and hard-code them into your site altogether.

In this post, discover the different WordPress tweaks you can implement on your site or blog so you can avoid the risks carried by certain plugins.

Why not use WordPress plugins?

As great as WordPress plugins are, they carry problems. Using the right amount of plugins can help improve your site’s performance tenfold. However, downloading too many plugins can slow down your site. Even if those plugins are indispensable parts

of your site, visitors will leave your site if it loads long enough.

According to recent studies, 40% of total visitors leave the site that loads longer than three seconds. Not to mention, Google takes site speed into consideration as a ranking factor. If your site isn’t ranking on search results, then you’ll let potential visitors slip away from you! This goes out to all people building their website from scratch – WordPress or not.

Finally, plugins carry security risks. Different developers upload their plugins into the repository, waiting for you to download them. And not all developers create plugins that are safe for use. There’s a small chance that hackers and online threats will use the plugin as a gateway to enter your site and steal your information.

To avoid these risks, you can limit the use of plugins on your site. Once you’ve narrowed down the plugins, you can simply code some of the features you want to add in your site using the WordPress tweaks below:

WordPress tweaks you need to use on your site now

1. Stop hotlinking

The valuable content you created and host on your site (infographics, videos, etc.) are potential culprits to your site’s slow loading time.

It’s normal if someone liked the infographic on your site so much that they used it on their own site. However, problems arise if they linked to your image instead of downloading and uploading the content to their servers. As a result, whenever people visit a page from their site with your infographic on it, their site borrows bandwidth from your site. This becomes a serious issue if their page attracts hundreds and thousands of visitors daily. It puts a strain in your hosting resources, thus creating a domino effect on your site’s loading time.

To avoid this issue, you need to prevent people from hotlinking to your site. Whenever people link to any of your content, your hosting will disable the content from showing on their site. This allows you to contain all your server resources to your site alone.

Copy and paste the code below on your .htaccess file to enable this feature:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?[your URL] [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?[your RSS feed] [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

Source: DevilHax

You need to edit your URL and RSS feed in the code before pasting it into the file. Also, you can consider changing the last line to add more file formats.

2. Add related posts with thumbnails

related posts

If you’re a blog, then having a related posts section appear at the bottom of the post allows readers to browse content similar to the one they just read. This helps increase visitor retention and potentially trigger engagement.

Instead of downloading a plugin for this purpose, you can simply use the code below and paste them in your functions.php file:

<?php $orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> 2, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo '<div id="related_posts"><h3>Related Posts</h3><ul>';
while( $my_query->have_posts() ) {
$my_query->the_post();?>
<li><div class="relatedthumb"><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a></div>
<div class="relatedcontent">
<h3><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_time('M j, Y') ?>
</div>
</li>
<?
}
echo '</ul></div>';
}
}
$post = $orig_post;
wp_reset_query(); ?>

Source: WPBeginner

The code above generates related posts by category. If you want to use tags instead, click on the link above for the code.

3. Creating popular post section on the sidebar

Similar to related posts, this section shows content that visitors can click and read on your site. However, instead of limiting the posts according to category or tag, you show the best performing posts on your site according to comments.

Copy and paste the code below on your sidebar.php file:

<h2>Popular Posts</h2>
<ul>
  <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
  foreach ($result as $post) {
    setup_postdata($post);
    $postid = $post->ID;
    $title = $post->post_title;
    $commentcount = $post->comment_count;
    if ($commentcount != 0) { ?>
      <li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>">
      <?php echo $title ?></a> {<?php echo $commentcount ?>}</li>
  <?php } } ?>
</ul>

You can change the number of posts that appear on the sidebar. As it stands, five posts will appear on this section. You can change the ‘5’ on line 3 to any number you weeks. Also, the post with the most comments will appear on top.

4. Remove post revisions

If you revise old posts constantly over the years, you may want to remove the old versions of each. WordPress stores all revisions in your database so you can still access them. However, if you don’t have any use for them, you can run the code below using phpMyAdmin every time you want to clean up your database:

DELETE from wp_posts WHERE post_type = "revision";

Before running this command, make sure to save your database first to ensure that all your files are safe. If something goes wrong accidentally, you can restore the files using the backup.

5. Add social media buttons to your post

There are lots of great plugins that lets you show social media buttons on your post. However, some plugins include buttons from social media sites you don’t use. All buttons load Javascript from each site, thus straining the bandwidth of your server.

social sharing

To keep your social media buttons simple and to the point, you can refer to this guide by Crunchify so you can buttons that don’t put a strain on your server. This way, you can maintain your site’s performance at optimum levels.

The guide shows you the code you need to paste on functions.php and style.css. Instead of posting the codes here, it’s best to simply check the page out to avoid confusion.

Are these WordPress tweaks enough to make your site load faster?

WordPress in itself is a powerful CMS with or without plugins. The latter helps make using WordPress much easier. However, if you can code the features of the plugins them into the site, then much better! As easy to use as plugins are, they carry risks that you don’t want for your site. Therefore, following the simple WordPress tweaks above helps you improve your site performance and keep it much more secure.

Related post:

WordPress Plugins: How To Talk Clients Out Of Hoarding Plugins

35 WordPress Themes For Achieving Higher Search Engine Rankings

Filed Under: WordPress

Recent Posts

  • 31 Fresh Design Elements for Spring and Easter
  • 10 Templates for Music Concert Flyers
  • How to Build a Web Scraper Using Node.js
  • Best PHP Books, Courses and Tutorials in 2022
  • How to Get Your First Web Design Client

Archives

  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • May 2008
  • April 2008

Categories

  • Accessibility
  • Android
  • Apps
  • Art
  • Article
  • Blogging
  • Books
  • Bootstrap
  • Business
  • CSS
  • Design
  • Development
  • Ecommerce
  • Fireworks
  • Flash
  • Freebies
  • Freelance
  • General
  • Giveaway
  • Graphic Design
  • HTML5
  • Icons
  • Illustrator
  • InDesign
  • Infographics
  • Inspirational
  • Interview
  • Jobs
  • jQuery
  • Learning
  • Logos
  • Matrix
  • Minimalism
  • Mobile
  • Motion Graphics
  • Music
  • News
  • Photoshop
  • PHP
  • Promoted
  • Rails
  • Resources
  • Showcase
  • Tools
  • Tutorial
  • Twitter
  • Typography
  • Uncategorized
  • Usability
  • UX
  • Wallpapers
  • Wireframing
  • WordPress
  • Work

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

SpyreStudios © 2022