Get the Official WPSaviour App Now!

BlogWordPress Security

7 Tricks to Stylify WordPress Blog to Suit Your Taste

WordPress, by default provides almost everything to start blogging right away. But, if you want to make your Blog stand out or like we always say stylify it to suit your own taste; here are some tricks you can implement.

All the WordPress tricks and tweaks mentioned below can be done manually and doesn’t require 3rd party plugin to be installed. Make sure you backup the original WordPress file before making any changes.

There is a plugin for everything that I’m mentioning below, but as we have talked before about the importance of using limited plugins, it’s  better to add certain features using custom code.

Useful WordPress Tricks for WordPress Developers and Users

1. Unlock Useful Buttons in the Visual Editor

WordPress visual editor has almost all the necessary buttons to edit the content of your article, but there are times that you need some slightly more detailed options such as styles, font sizes, etc..

To do this just paste the following code in the functions.php :

enable_more_buttons function ($ buttons) {
$ Buttons [] = 'h';
$ Buttons [] = 'sub';
$ Buttons [] = 'sup';
$ Buttons [] = 'fontselect';
$ Buttons [] = 'fontsizeselect';
$ Buttons [] = 'cleanup';
$ Buttons [] = 'styleselect';
return $ buttons;
add_filter ("mce_buttons_3" "enable_more_buttons");

With the above function adds a third row of buttons including buttons to the editor: include a horizontal, sub-indices, super-indices, select font type, font size, clean code and select styles. You can add more styles if you want, here’s
a list of available buttons.

2. Allow more HTML tags in your HTML editor for WordPress

WordPress HTML editor does not allow HTML tags that are not XHTML 1.0. This code makes the editor accepts more tags, so you just stick it in the file functions.php :
change_mce_options function ($ initArray) {
$ Ext = 'pre [id | name | class | style], iframe [align | longdesc |
name | width | height | frameborder | scrolling | marginheight |
marginwidth | src]';

if (isset ($ initArray [‘extended_valid_elements’])) {
$ InitArray [‘extended_valid_elements’]. = ‘,’. $ Ext;
Else {}
$ InitArray [‘extended_valid_elements’] = $ ext;

return $ initArray;
add_filter (‘tiny_mce_before_init’, ‘change_mce options’);

3. Make your WordPress post look better when shared to Facebook

This code is used when a user to share your article to Facebook, look your best, with related image or default image, web link to the author, title, description, etc.. You can achieve the same with Social feature of WordPress SEO by Yoast plugin, but remember it’s good to have less number of plugins.

Simply place the following code in the header.php of your theme before the <? php wp_head ();?> :

<? Php
$ Thumb = get_post_meta ($ post-> ID, '_thumbnail_id', false);
$ Thumb = wp_get_attachment_image_src ($ thumb [0], false);
$ Thumb = $ thumb [0];

<? Php if (is_single () | | is_page ()) {?>
<meta property=”og:type” content=”article” />
<Meta property = “og: title” content = “<? Php single_post_title (”);?>” />
<Meta property = “og: description” content = “<? Php
while (have_posts ()): the_post ();
$ Out_excerpt = str_replace (array (“\ r \ n”, “\ r”, “\ n”), “”, get_the_excerpt ());
ECHO apply_filters (‘the_excerpt_rss’, $ out_excerpt);
endwhile;?> “/>
<Meta property = “og: url” content = “<? Php the_permalink ();?>” />
<Meta property = “og: image” content = “<? Php if ($ thumb [0] == null) {echo catch_that_image ();} else {echo $ thumb;}?>” />
<? Php} else {?>
<meta property=”og:type” content=”article” />
<Meta property = “og: title” content = “<? Php bloginfo (‘name’);?>” />
<Meta property = “og: url” content = “<? Php bloginfo (‘url’);?>” />
<Meta property = “og: description” content = “<? Php bloginfo (‘description’);?>” />
<Meta property = “og: image” content = “<? Php if ($ thumb [0] == null) {echo catch_that_image ();} else {echo $ thumb;}?>” />
<? Php}?>
Then paste the following code in the functions.php :
catch_that_image function () {
global $ post, $ posts;
$ First_img ='';
ob_start ();
ob_end_clean ();
$ Output = preg_match_all ('/ <img.+src=[\'"]([^\'"]+)[\'"].*> / i', $ post-> post_content, $ matches);
$ First_img = $ matches [1] [0];

if (empty ($ first_img)) {/ / Defines a default image
$ First_img = get_bloginfo (‘stylesheet_directory’). “/ Images / default_icon.jpg”;
return $ first_img;
Here you just have to change “default_icon.jpg” for the image you want to leave the default.

4. Remove Update Notification for Non-Administrators

This code makes the WordPress update notification are only visible to site administrators. Copy and paste the following code in the functions.php :
global $ user_login;
get_currentuserinfo ();
if ($ user_login! == "admin") {
add_action ('init', create_function ('$ a', "remove_action ('init', 'wp_version_check');"), 2);
add_filter ('pre_option_update_core', create_function ('$ a', "return null;"));

5. Allow contributors to upload files

As a security measure WordPress does not allow contributors to upload files to your blog. But if you still want them to do so, here I leave the code you need to paste in the file functions.php :
if (current_user_can ('contributor') & amp; & amp;! current_user_can ('upload_files'))
add_action ('admin_init', 'allow_contributor_uploads');
allow_contributor_uploads function () {
$ Contributor = get_role ('contributor');
$ Contributor-> add_cap ('upload_files');

If there are more user roles than the ones created by WordPress, I will recommend using Members Plugin to manage rules and privileges. If you looking for an easy front-end solution to let users upload image files, you can look at user submitted post plugin.

6. Search Redirect if only one result

This code redirects the first article of a search result if there is only one item in the search. This will help to save your user time, and improve user experience. Paste this into the file functions.php :
add_action ('template_redirect', 'single_result');
single_result function () {
if (is_search ()) {
global $ WP_Query;
if ($ WP_Query-> post_count == 1) {
wp_redirect (get_permalink ($ WP_Query-> posts ['0 '] -> ID));

7. Disable Changing WordPress Theme

When you create a WordPress site for a client, maybe you should make sure that it can not change the theme of the blog. For this just paste the following code in the functions.php :
add_action ('admin_init', 'change_theme');
change_theme function () {
global $ submenu, $ userdata;
get_currentuserinfo ();
if ($ userdata-> ID! = 1) {
unset ($ submenu ['themes.php'] [5]);
unset ($ submenu ['themes.php'] [15]);

I hope these WordPress tricks will help you to improve the usability of your WordPress blog. You can download WordPress setup guide here (Right click & save). Do share if you have any other tip for us.

Download The WPSaviour App Now

Related posts
Best WordPress PluginsBlog

WordPress 5.4 Will Add Lazy-Loading to All Images

Beginner’s GuideBlog

How to Add a Preloader Animation to WordPress (Step by Step)


Install WordPress On Ubuntu Locally With LAMP


Theme Customizer Boilerplate – Conditional Options, Child Themes and Plugins

Sign up for our Newsletter and
stay informed

Leave a Reply

Your email address will not be published.