• X

    7 Tricks to Stylify WordPress Blog to Suit Your Taste

    By in WordPress

    Bluehost hosting

    WordPress tricks 7 Tricks to Stylify WordPress Blog to Suit Your TasteWordPress, 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.

    This is a guest post by Rohit Langde from BlogSolute. If you would like to write for ShoutMeLoud, check our submission guidelines.

    Get Free Blogging updates in your Email

    Find more Topics based on Keywords

    Article by

    Rohit has written 1 articles.

    If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to ShoutMeLoud feed via RSS or EMAIL to receive instant updates.

    { 7 comments… read them below or add one }

    Dhruv

    Hi Rohit,

    Can you tell me any way to build an amazing landing page for my blog..!
    I am also using Genesis..!
    Any reply would be appreciated..!

    Thanks..!

    Reply

    Atul Kumar Pandey

    This seems to be good as it is but it needed so much coding. Little bit tricky but finally can be done with some practices.

    Reply

    Chetan Bhasin

    Really a great guide! I will try them for sure! :D
    Requires coding, but it’s fine since we have to do it only once.

    Reply

    Rashmi Sinha

    Nifty little tricks that I will love to try next time when I use WordPress. Though the WordPress platform offer pretty much everything, these tricks are just right on the money and definitely worth a try.

    Reply

    Ram Shengale

    Wow man, this is great. Thanks for the great tips. Using these codes is a lot better than having a plugin for each functionality.

    Ram

    Reply

    Anmol

    Hey! Thanks for your tips. I was trying the first tip and added the code in functions.php in php blocks page and it didn’t work .

    Reply

    Gautam Doddamani

    good guide rohit…i use almost all the optimization techniques discussed here…but cant disable the option to change themes…i have changed quite few many lol :D

    Reply

    Leave a Comment

    Previous post:

    Next post:

    `