Tuesday, 31 December 2013

Amazing Post Navigation For Blogger


It's already 2014 here in India, so I'd like to wish you all a very happy New Year. Stay safe and don't drink to much ;)

It's still New Year's Eve in most of part of the globe, so let me end the year with a final post on this blog. And this tutorial comes from the Blogger King MBT.

It's a new stylish jQuery post navigation for your blog. It'll appear on in your Blogger posts and it'll definitely catch the attention of your readers. The pagination buttons make no sense when placed at the bottom of comments container.

Add This To Blogger:

First. we will add CSS and some necessary script to our Blogger template.

  • Go To Blogger > Template
  • Click "Edit HTML"
  • Search and add following CSS just above ]]></b:skin>

    /*################MBT Pager ##########################*/

    .mbt-pager { border-top: 2px dashed #ddd; border-bottom: 2px dashed #ddd;  margin-bottom: 10px;   overflow:hidden; padding:0px;}
    .mbt-pager li.next { float: right; padding:0px; background:none; margin:0px;}
    .mbt-pager li.next a { padding-left: 24px; }

    .mbt-pager li.previous { margin:0px -2px 0px 0px; float: left;  border-right:1px solid #ddd; padding:0px; background:none;
    }
    .mbt-pager li.previous a { padding-right: 24px;  }

    .mbt-pager li.next:hover, .mbt-pager li.previous:hover  {background:#333333; }

    .mbt-pager li { width: 50%; display: inline; float: left; text-align: center; }
    .mbt-pager li a { position: relative; min-height: 77px; display: block; padding: 15px 46px 15px; outline:none; text-decoration:none;}

    .mbt-pager li i { color: #ccc; font-size: 18px; }

    .mbt-pager li a strong { display: block; font-size: 20px; color: #ccc; letter-spacing: 0.5px; font-weight: bold; text-transform: uppercase; font-family:oswald, sans-serif, arial; margin-bottom:10px;}

    .mbt-pager li a span { font-size: 15px; color: #666;  font-family:oswald,Helvetica, arial; margin:0px;}
    .mbt-pager li a:hover span,
    .mbt-pager li a:hover i { color: #ffffff; }
    .mbt-pager li.previous i { float:left; margin-top:15%; margin-left:5%; }
    .mbt-pager li.next i { float: right;
    margin-top: 15%;
    margin-right: 5%; }

    .mbt-pager li.next i, .mbt-pager li.previous i ,
    .mbt-pager li.next,  .mbt-pager li.previous{
    -webkit-transition-property: background color; -webkit-transition-duration: 0.4s; -webkit-transition-timing-function: ease-out;
    -moz-transition-property: background color; -moz-transition-duration: 0.4s; -moz-transition-timing-function: ease-out;
    -o-transition-property: background color; -o-transition-duration: 0.4s; -o-transition-timing-function: ease-out;
    transition-property: background color; transition-duration: 0.4s; transition-timing-function: ease-out; }

    .fa-chevron-right {padding-right:0px;}

  • Now, we will add fonts from Google Fonts & jQuery support.  Search for <head> and just below it paste the following code:

<script src="http://widcraft.googlecode.com/svn/jquery.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>

  • Now, it's for the main event. We will add our navigator to the bottom of your post. Search for data:post.body and paste following below it:

    <b:if cond='data:blog.pageType == &quot;item&quot;'>

    <b:if cond='data:blog.pageType != &quot;static_page&quot;'>

    <ul class='mbt-pager'>

            <li class='next'>
    <b:if cond='data:newerPageUrl'>
    <i class='fa fa-chevron-right'/><a class='newer-link' expr:href='data:newerPageUrl' expr:id='data:widget.instanceId + &quot;_blog-pager-newer-link&quot;' rel='next'/>
    <b:else/>
    <i class='fa fa-chevron-right'/><a rel='next'><strong>Next</strong> <span>You are viewing Most Recent Post</span></a>
    </b:if>
    </li>

        <li class='previous'>
    <b:if cond='data:olderPageUrl'>
    <i class='fa fa-chevron-left'/><a class='older-link' expr:href='data:olderPageUrl' expr:id='data:widget.instanceId + &quot;_blog-pager-older-link&quot;' rel='previous'/>
    <b:else/>
    <i class='fa fa-chevron-left'/><a rel='previous'><strong>Previous</strong> <span>You are viewing Last Post</span></a>
    </b:if>
    </li>

        </ul>


    <script type='text/javascript'>
    //<![CDATA[
    (function($){  
        var newerLink = $('a.newer-link');
        var olderLink = $('a.older-link');
        $.get(newerLink.attr('href'), function (data) {
         newerLink.html('<strong>Next</strong> <span>'+$(data).find('.post h3.post-title').text()+'</span>');  
        },"html");
        $.get(olderLink.attr('href'), function (data2) {
         olderLink.html('<strong>Previous</strong> <span>'+$(data2).find('.post h3.post-title').text()+'</span>');  
        },"html");
    })(jQuery);
    //]]>
    </script>

          </b:if></b:if>

Save your template, and that's it for this year!

Huge Announcement:

In 2014, BWidgets.com will only cover stuff related to Blogger & Google. All WordPress and other stuff will go into your NEW WEBSITE (details coming soon). Our new site will also feature a new Google PageRank checker among other cool tools. So stay tuned!

Friday, 13 December 2013

Add Falling Snow To Blogger

Single bells single bells single all the way! It's HOLIDAY SEASON, and we're back with another great script. It's a great script and will work everywhere, not just Blogger.

This great script comes from schillmania.com. It's just a single .js file, we don't need any jquery support for this script. Just add this script to your Blogger blog and we're done. For newbies, here's how to add:

  • Blogger > Template > Edit HTML> Add following script just above </head> tag:

<script src="https://widcraft.googlecode.com/svn/snowstorm.js"></script>

Want to customize snow fall effects? See Customizing Snowstorm for more.

Wednesday, 11 December 2013

Take Screenshot In Windows Without Any Software

Today I'm sharing a very basic, but a very useful trick with you all. Most of us bloggers have a screenshot software on their devices, but they're just a waste of space as you can easily shot your screen with one click! Here's how to do it:


Press PrntScr key and Windows captures the entire screen and copies it to its clipboard. Now start “Paint” or any other software where you can paste an image. Hold CTRL and press V and Windows pastes the screenshot, which is in the clipboard, into your document. Now just save your image!

Tuesday, 3 December 2013

How To Enable Jetpack Stats On MobilePress

Almost every WordPress admins uses WordPress' Jetpack plugin on their site to connect and use WordPress.com feature on their self-hosted WordPress. There are a lot of great modules in the Jetpack plugin, but Jetpack Stats module is my personal favorite.

MobilePress is also a well known plugin to create a mobile friendly version of your WordPress. It allows custom themes and a few other mobile friendly settings. But Jetpack's stats module only tracks the desktop version of your site, not the MobilePress version.

Don't worry about this, as I have found a way to enable Jetpack's stats module on our MobilePress. Here is how:

  • First of all, enable Jetpack stats module on your WordPress. Now visit your WordPress website as a guest (without signing in).
  • Now right click & click on View Page Source to view the source code of your current page, and search stats.wordpress.com in the source code page. You'll find a code similar to this:

<script src="http://stats.wordpress.com/e-201349.js" type="text/javascript"></script>
<script type="text/javascript">
st_go({v:'ext',j:'1:2.6',blog:'YOURUNIQUEBLOGID',post:'0',tz:'-5'});
var load_cmc = function(){linktracker_init(YOURUNIQUEBLOGID,0,2);};
if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
else load_cmc();
</script>

  • Copy your unique blog id from your unique Jetpack stats snippet and place it in the following code:

<script src="http://stats.wordpress.com/e-201341.js" type="text/javascript"></script><script type="text/javascript">
st_go({v:'ext',j:'1:2.5',blog:'YOURUNIQUEBLOGID',post:'<?php the_ID(); ?> ',tz:'-4'});
var load_cmc = function(){linktracker_init(YOURUNIQUEBLOGID,0,2);};
if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc);
else load_cmc();
</script>

  • Now paste the above code in the footer.php (webroot / wp-content / plugins / mobilepress / themes / default / footer.php) file of your current MobilePress theme. That's IT!!

As you can see, there's only one difference in the above two codes. In the second code, I have replaced the current post id with <?php the_ID(); ?>, otherwise your Jetpack wouldn't count views for specific page, and all your visits would be counted as Homepage views or of a specific post.

Saturday, 30 November 2013

Set WordPress Permalinks Settings From functions.php

Permalinks are the permanent URLs to your individual WordPress or blog posts, as well as pages and other lists of blog postings. It's very important to have an easy and beautiful permalinks structure for your site, as it's a part of optimizing your site for SEO.

The default WordPress permalinks structure looks something like this:

http://www.whatever.com/?p=316

And I hate this as much as you all do. However, you can change the default structure of your blog permalinks in the settings of your WordPress blog. But we can also change the default permalinks structure from our functions.php file.

It's pretty easy, just add following snippet to your functions.php file:

<?php
// set permalink
function set_permalink(){
    global $wp_rewrite;
    $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%postname%/');
}
add_action('init', 'set_permalink');
?>

Use this snippet to change the permalink settings from your functions.php file instead of in the admin area. You can replace the red area in above code with following structure codes:

%year%
    The year of the post, four digits, for example 2004

 %monthnum%
    Month of the year, for example 05

 %day%
    Day of the month, for example 28

 %hour%
    Hour of the day, for example 15

 %minute%
    Minute of the hour, for example 43

 %second%
    Second of the minute, for example 33

 %post_id%
    The unique ID # of the post, for example 423

 %postname%
    A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URI.

 %category%
    A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI.

 %author%
    A sanitized version of the author name.

Thursday, 28 November 2013

Disable Auto Updates In WordPress

WordPress 3.7 came out with a new automatic background update feature in an effort to promote better security. By the default, only minor releases and translation file updates are enable. But we could manually disable or enable anything we want.

Just put following codes to your wp-config.php file to disable/enable the updates:

To specifically enable development (nightly) updates, use the following:

add_filter( 'allow_dev_auto_core_updates', '__return_true' );

To specifically disable minor updates, use the following:

add_filter( 'allow_minor_auto_core_updates', '__return_false' );

To specifically enable major updates, use the following:

add_filter( 'allow_major_auto_core_updates', '__return_true' );

Plugins, themes and translation file:

Automatic plugin and theme updates are disabled by default.

To enable automatic updates for plugins, use the following:

add_filter( 'auto_update_plugin', '__return_true' );

To enable automatic updates for themes, use the following:

add_filter( 'auto_update_theme', '__return_true' );

Automatic translation file updates are already enabled by default, the same as minor core updates.  To disable translation file updates, use the following:

add_filter( 'auto_update_translation', '__return_false' );

Core Updates:

To disable all core-type updates only, use the following:

add_filter( 'auto_update_core', '__return_false' );

All Updates

To completely disable all types of automatic updates, core or otherwise, add the following to your wp-config.php file:

define( 'AUTOMATIC_UPDATER_DISABLED', true );

You can also disable all automatic updates using the following filter:

add_filter( 'automatic_updater_disabled', '__return_true' );

Hope this would help you. Source: WordPress Codex

Wednesday, 27 November 2013

Most Expensive Pay Per Click Campaigns


Every year businesses and marketing companies around the globe search for new ways to increase revenue and traffic to their website. Publicity is generally always a good thing and increased number of unique visitors to a website usually results in a larger number of sales. Businesses are constantly competing for the top spots on search engine result pages but reaching the top 3 natural links is often a long tedious and challenging task.

Pay per click or adword marketing campaigns have become ever more prevalent in recent years as companies have began to realise its potential to increase profits exponentially. A PPC campaign is the process of bidding on a phrase that you have deemed relevant to your industry. When your paid link is followed through by a potential customer you will be charged according to the amount bid for.

Paid links are so popular because they eliminate the need to earn a top spot in natural search listings. Paid links are always placed in prime locations of the website and taking google as an example we would mostly likely see these phrases as the top 2-3 search results (usually highlighted in yellow) and on the right hand side of a page. By having links in such opportune positions you will significantly increase the chances of consumers visiting your website.

The price of each click is determined by many factors and can start from pennies per click, however this is not always the case any many businesses find themselves paying upwards of $140.

Competition is generally regarded as the reason for inflated costs. An example of this would be the search term 'Mesothelioma attorney' which along with many other asbestos compensation phrases holds a spot as one of the most expensive phrases. It was suggested that a legal firm in Florida was paying upwards of $200 for each click owed to competition in that area being so great. Asbestos compensation claims are a rather lucrative industry so attorneys are willing to pay 'over the odds' to not only generate a lead but to prevent a rival company from benefiting from the lead.

The type of industry that the search is related to can also affect the cost of a phrase, industries that sell legal services, web space and insurance dominate the top spots of most expensive PPC phrases. Most legal services are around $100 per click whilst insurance can range anywhere from $30-$80 per click.

Google is by far the most popular place for businesses to bid for keywords using their adwords platform. This is due to the fact that over 60% of people use google with the other sharing the other 40%. This give you more opportunity to bring potential custom to your business. Other search engine such as Yahoo and bing offer a similar service and are usually cheaper per click.

Finally the length of a search term can make or break a PPC campaign, a phrase that is overly broad may acquire many unique visitors however the amount of people who purchased your service would be lower (due to you not being quite what they want) and you would be paying a much higher rate per link. An overly specific search term would be cheaper and would receive far less visitors however the percentage of people who go on to buy something would be no doubt higher.

An example of this would be a company selling custom t-shirt, paying for the search term 'buy a t-shirt' would yield vast amounts of visitors however not many would purchase the item whereas 'buy a black t-shirt with a picture of a dog' would have far less visitors but a greater turn around rate.

Author Author - Adam Howard writes for Atrium on workers health. Asbestos is the biggest killer of industrial workers so litigation in this area is very lucrative. Due to this it is very competitive which is reflected in paid search click prices.

Saturday, 23 November 2013

Add Extra CSS In WordPress Posts With Custom Fields

I posted last couple of WordPress articles on BWidgets about the amazing power of custom fields. This is article is also about another great use of custom fields.

Sometimes, a specific post needs to be more styles with some custom CSS codes. We all know that we can directly write our CSS code in post editor, but that's not very clean way to do this. So, we're going to do this with custom fields.

This is clean, easy, and a bit fun as well. Yea, these things makes me feel like James Bond 007. Here we go:

First, we need to add following code to your WordPress theme's header.php file:

<?php if (is_single()) {
    $css = get_post_meta($post->ID, 'css', true);
    if (!empty($css)) { ?>
        <style type="text/css">
        <?php echo $css; ?>  
        </style>
    <?php }
} ?>

Save the file. Once saved, when you're writing a post which requires some custom extra CSS styling, you'll just have to put your custom CSS styles in a custom field named css.

Friday, 22 November 2013

How To Get Custom Fields Outside The Loop In WordPress

Custom fields are one of the most useful and powerful feature in WordPress and are used on many WordPress-powered blogs. In this post, I'm going to show you how to get custom fields values outside the loop.

Thanks to Paul Whitehead for this trick. I want to share link to his website, but the website is dead right now.

Simply post following snippet anywhere in your WordPress site. Don’t forget to replace customField on line 4 by the name of the custom field you want to display.

<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'customField', true);
?>

Wednesday, 20 November 2013

How To Get Value Of A Specific Custom Field In WordPress

WordPress allows us to add custom fields to a our posts, which adds extra information, which is known as meta-data. But we can do a lot more there custom fields. For example, I embedded a video in this post with the use of custom fields.

More of newbies gets confused when it comes to use custom fields. But they're not that complicated, at least the basic use of these fields.

Here's how you can get value of a specific custom field in your WordPress posts:

<?php echo get_post_meta($post->ID, 'mood', true); ?>

"mood" would be ID value of custom field. That was simple.

And here's how to display custom field only if exists:

<?php
    $url = get_post_meta($post->ID, 'snippet-reference-URL', true);

    if ($url) {
        echo "<p><a href='$url'>Reference URL</a></p>";
    }
?>

Sunday, 17 November 2013

Using A Different Post Template For Posts Within A Specific Category

On Thursday I posted an article about using different post template for posts formats, but now it's time for doing the same thing with categories, instead of formats. You can use this trick in your WordPress to create different type of posts, such as portfolio items.

We discussed everything previously, so let's get into this trick:

Using A Different Post Template:

In this tutorial, we'll create a different post template for the cat-1 category. We'll use multiple single.php files to make it more easy and customizable.

Create a single.php file for your category. We're going to name it single-cat-1.php. You can also copy your single.php file to this template and make some changes that you want in the video template.

Upload single-cat-1.php to the root of your current theme. Same place where single.php file is located.

Okay, so now we'll tell WordPress to use single-cat-1.php template for the posts within video category. Add following to your theme's functions.php file:

add_action('template_include', 'load_single_template');
  function load_single_template($template) {
    $new_template = '';

    // single post template
    if( is_single() ) {
      global $post;

      // 'cat-1' is category slugs
      if( has_term('cat-1', 'category', $post) ) {
        // use template file single-template-cat-1.php
        $new_template = locate_template(array('single-cat-1.php' ));
      }

    }
    return ('' != $new_template) ? $new_template : $template;
  }

In above code, replace cat-1 is the slug of your category, and single-cat-1.php is your custom post template file. Save the file. That's it.

How To Log Out From New Facebook Messenger Android App


Facebook has released the latest update of its Messenger app for Android. This release covers some major changes in the app interface and features. You can also text your contracts from this app, which makes it replacement of texting.

But Facebook forgot to add something in this new upload. There's no option to Log Out of your account in this new update. Don't worry there's a solution of every problem.

Most of us used to log out of our Facebook accounts from Account settings menu, which will not work in this case. Here's how to log out from this app:

In Gingerbread: Click on Settings > Applications > Manage applications > Find and click on "Messenger" > Click on Clear Data > That's IT!

In ICS & JellyBean: Click on Settings > Apps > Find and click on "Messenger" > Click on Clear Data > That's IT!

Friday, 15 November 2013

Is Your Website Down For Everyone Or It's Just You?

A couple of days ago my website WWEFansNation.com's server went down, and the following message appeared:

503 Service Unavailable: The server is currently unavailable (because it is overloaded or down for maintenance)

But my website was not down at all. It was just my WiFi operator's fault. It was just down on my WiFi connection, but was up to entire universe.

My fellow blogger, Rajat Garg of TrueBloggerTips, passed me link to isup.me to check whether my website is down for everyone or it's just me.

You can also check if your website is down for everyone or it's you by visiting isup.me.

Thursday, 14 November 2013

Using A Different Post Template For Posts Formats In WordPress

Post Formats is a theme feature which was introduced with the WordPress 3.1 release. It gave us a new feature to style posts based on its format. If you ever used WordPress' default themes, then you might know about their different post templates based on the post format. So it's time for you to style your posts based on its format. Here's a demo of this trick from my own WordPress site:

This is a simple post.

This is a video post with a different template.

Add Post Format Support To Your WordPress Theme:

Before starting this tutorial, it's important for you to add support for post formats in your current WordPress theme. If this section is available in your post editor then you can skip this step:


If not, then follow this tutorial.

Using A Different Post Template:

In this tutorial, we'll create a different post template for the Video format. Most of developers uses a single post template file for all different format. But we'll use multiple single.php files to make it more easy and customizable.

Create a single.php file for your post format (we're using Video). We're going to name it single-video.php. You can also copy your single.php file to this template and make some changes that you want in the video template.

Upload single-video.php to the root of your current theme. Same place where single.php file is located.

Okay, so now we'll tell WordPress to use single-video.php template for the posts with video format. Add following to your theme's functions.php file:

add_action('template_include', 'load_single_template');
  function load_single_template($template) {
    $new_template = '';

    // single post template
    if( is_single() ) {
      global $post;

      // template for post with video format
      if ( has_post_format( 'video' )) {
        // use template file single-video.php for video format
        $new_template = locate_template(array('single-video.php' ));
      }

    }
    return ('' != $new_template) ? $new_template : $template;
  }

Save the file. That's it.

Now just publish a post with video format & see the magic. You can do the same with every post format. On a related note, I'll also share the same trick with categories, instead of formats.

Add Post Formats To WordPress Theme

It's school holiday for five days in a row, so as a part of the second day of this holiday, I was doing some random stuff around the internet, such as listing to new songs, reading about upcoming Next-Gen gaming consoles, browsing troll memes, blaming Justin Bieber, and more.

So in this busy day I took some time to edit my WordPress website for new feature. I did some thing new (at least for me) with some post formats, and I'm going to share it here on BWidgets. So as a part of that tutorial, here's the basic thing to learn before I post that article, which is adding post format support to your WordPress theme.

Post Formats is a theme feature introduced with the WordPress 3.1 release. It's piece of meta info that can be used by a theme to customize its post structure. If you ever used Tumblr, then you'll love this feature.

As of now, WordPress supports following post formats:

  • aside: Typically styled without a title. Similar to a Facebook note update.
  • gallery: An image gallery. This type of post will likely contain an image gallery using shortcode and plugins.
  • link: A link to an external webpage.
  • image: A single image. Yeah, just a single image.
  • quote: A quatation. My favorite quote is: Your arms are just too short to box with the God. - CM Punk to Dwayne "The Rock" Johnson
  • status: A short status update, similar to a tweet.
  • video: A single video or several videos. You can upload or embed a video to the post.
  • audio: An audeo file, likely if you run a Podcast.
  • chat: A chat transcript.

Add following snippet to your theme's functions.php file to add post format support to your post:

add_theme_support( 'post-formats', array( 'aside', 'chat','gallery','image','link', 'quote', 'status', 'video', 'audio' ) );

You can also add post format support to Page and custom post types:

// add post-formats to post_type 'page'
add_post_type_support( 'page', 'post-formats' );

// add post-formats to post_type 'my_custom_post_type'
add_post_type_support( 'my_custom_post_type', 'post-formats' );

Wednesday, 13 November 2013

Remove Default Widget Bundle CSS From Blogger

If you're a Blogger template designer, then this article is very very helpful for your future designs. If you're a designer, then you probably know about two default Blogger stylesheets- widget_css_bundle.css and widget_css_2_bundle.css. Becaue they make it more diffecult for you to design your template.

Blogger automatically adds the following code in your Blogger template:

<link type='text/css' rel='stylesheet' href='//www.blogger.com/static/v1/widgets/1937454905-widget_css_bundle.css' />

<link type='text/css' rel='stylesheet' href='//www.blogger.com/static/v1/widgets/4219271310-widget_css_2_bundle.css' />

So it's time for your to remove there stylesheets from your Blogger template. If you don't know above there stylesheets, then don't follow this tutorial. Removing this code maybe can make your template destroyed, if you use official widgets from Blogger.

We are not really removing this code from our template, but this trick will make that code ignored by your browser. This tutorial is just converting that code to HTML comments, thanks to Damzaky for this trick.

  • Open Blogger > Template > Edit HTML, proceed, then CTRL+F this code: <b:skin><![CDATA[
  • If you have found that code, in below that code you may found your CSS, so just copy all the CSS to a notepad or anywhere because we need this code later in this tutorial.
  • Then the remaining code is  <b:skin><![CDATA[    ]]></b:skin>
  • Replace above code with following:

&lt;style type=&quot;text/css&quot;&gt;

&lt;!-- /*<b:skin><![CDATA[*/]]></b:skin>

  • Then post following code just above the </head> of your template:

<style type='text/css'>

YOUR CSS FROM NOTEPAD

</style>

  • In above code, replace the YOUR CSS FROM NOTEPAD from all CSS from your notepad that we copied earlier.
  • Save your template.

That's it.

Monday, 11 November 2013

Change WordPress Login Logo Without Plugins

Above is a screen shot of the login page of my WordPress website. As you can see in above image, I'm using my website's logo in the login page instead of WordPress logo. And it looks pretty good.

If you're running a website with public registration or a client website, then you should replace the default logo with your own. There are lots of plugins to change the custom logo in some easy steps. However, we're going to do this without any plugin.

Add this snippet to the functions.php file of your active theme:

<?php
function custom_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image:url('CUSTOM-LOGO-URL.png') !important; }
    </style>';
}
add_action('login_head', 'custom_login_logo');
?>

Replace the CUSTOM-LOGO-URL.png in above code with url of your custom login logo. That's it.

Sunday, 10 November 2013

How To Set Minimum Word Count For WordPress Posts

If you're running a WordPress site with some co-authors then it's really important for you to focus on your content's quality. Quality content is the ultimate key to success in blogging. Most of bloggers write like a monkey in the very beginning; I was also in that league when I started this blog.

Since recent Google updates you can no longer post an article with some couple of words and expect the post to rank highly for the keywords in the title. Now you need more content in the entire post with a lot of different keywords.

With WordPress you can create a function to make sure that you have a minimum number of words in your post.

By adding following code to your functions.php file, you can check if the post is under 500 words and if it is you can end the publishing process so the post will not be published:

function minimum_number_words($content)
{
    global $post;
    $content = $post->post_content;
    if (str_word_count($content) < 500 )
    wp_die( __('The current post is below the minimum number of words, it must be over 500 words.') );
}

Friday, 8 November 2013

How To Set Minimum Comment Length In WordPress

Most of us turn on comments in our sites to start a discussion and reach out more people. But some people comment just to get a link back to their own site. Their comments will consist of things like "nice post", "thanks" and all stuff.

If you're running a big website, then moderating these crappy comments will waste a lot of time. So how about setting a minimum character count length on your comments.

Add following snippet to your functions.php file:

add_filter( 'preprocess_comment', 'minimal_comment_length' );

function minimal_comment_length( $commentdata ) {
    $minimalCommentLength = 20;

    if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength )
        {
        wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
        }
    return $commentdata;
}

Save your file. That's it. You can also replace 20 in the above code with your custom value.

Thursday, 7 November 2013

Google Adsense Stats Plugin For WordPress

Most of us use Google Adsense as our primary source of earning. Believe me, they're the reason of me running a whole network of websites. So I found a great plugin to display stats of your Adsense in the backend of your WordPress website.

The description of this widget reads, "Earnings Dashboard will display your Google Adsense earnings and related reports inside your WordPress Blog, on your Administration Dashboard."

You can download this plugin from this link.

How To Install And Activate This Plugin:

  • Click here and download this plugin. Visit your WordPress' plugin page and install this plugin.
  • You can also install this plugin from your WP's plugin directory.
  • After installing, activate the plugin through the 'Plugins' admin menu in WordPress.
  • Open the plugin configuration page, which is located under Settings > Earnings Dashboard (optionally enter your API Key, Client Secret and Client ID).
  • Authorize the application using the 'Authorize Application' button
  • Go back to the plugin configuration page, which is located under Settings > Earnings Dashboard to update the final settings.

That's it.

Tuesday, 5 November 2013

Bulk Remove Featured Images From WordPress Posts

By default, there's no such option in WordPress to remove featured image from all posts at once. You can only remove the featured image by editing each post and removing it manually. It can take a lot of time. For example, it's almost impossible to manually remove featured images from my WWEFansNation.com with more than 4,000 posts. But that's all right cuz we're here to solve this problem.

WPBeginner found a great way to remove (unset) featured images from all posts in bulk. It's worth nothing that this code will only remove the featured image from the posts, and the image will not be deleted from your site.

Copy & paste following code in your theme's functions.php file:

global $wpdb;

$attachments = $wpdb->get_results( "
     SELECT *
     FROM $wpdb->postmeta
     WHERE meta_key = '_thumbnail_id'
" );

foreach ( $attachments as $attachment ) {
    wp_delete_attachment( $attachment->meta_value, true );
}

$wpdb->query( "
    DELETE FROM $wpdb->postmeta
    WHERE meta_key = '_thumbnail_id'
" );

Important: Please remove this code immediately after saving your functions.php file. You only need to run this code once, there's no need to keep this code in your theme.

Monday, 4 November 2013

Automatically Set The Featured Image In WordPress

Almost every WordPress theme developer is using WordPress' featured post image option in their latest themes, and it's a very great option. You can pick any image for your article before publishing

But ofter we forget to pick a featured image for out posts. Also there's no way to pick a featured image in WordPress' smartphone application. So today we're going to automatically set the featured image.

This snippet will automatically set the first image of your post as the featured image of the post. Note, you can always go and set another image as the featured image if you want to.

Add following snippet to your functions.php file:

function wpforce_featured() {
          global $post;
          $already_has_thumb = has_post_thumbnail($post->ID);
              if (!$already_has_thumb)  {
              $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
                          if ($attached_image) {
                                foreach ($attached_image as $attachment_id => $attachment) {
                                set_post_thumbnail($post->ID, $attachment_id);
                                }
                           } else {
                                set_post_thumbnail($post->ID, '414');
                           }
                        }
      }  //end function
add_action('the_post', 'wpforce_featured');
add_action('save_post', 'wpforce_featured');
add_action('draft_to_publish', 'wpforce_featured');
add_action('new_to_publish', 'wpforce_featured');
add_action('pending_to_publish', 'wpforce_featured');
add_action('future_to_publish', 'wpforce_featured');

There is one more cool option in this code. If you don't have an image in the post, the above code will let you set a default featured image as well. You must edit the attachment ID according to your WordPress site. The example above uses the attachment ID "414"

Credits: WPForce

Sunday, 3 November 2013

Move WordPress Admin Bar To The Bottom

Ever wanted to move your WordPress blog's Admin Bar to bottom of the page? If yes, then this is the right place for you. It sounds like a telemall commercial, lol. With just a bit CSS you can change it. So instead of editing the core CSS files, we'll add some CSS to your functions.php file.

Put this little snippet to a Plugin or in the functions.php of your theme:

 function fb_move_admin_bar() {
    echo '
    <style type="text/css">
    body {
    margin-top: -28px;
    padding-bottom: 28px;
    }
    body.admin-bar #wphead {
       padding-top: 0;
    }
    body.admin-bar #footer {
       padding-bottom: 28px;
    }
    #wpadminbar {
        top: auto !important;
        bottom: 0;
    }
    #wpadminbar .quicklinks .menupop ul {
        bottom: 28px;
    }
    </style>';
}
// on backend area
add_action( 'admin_head', 'fb_move_admin_bar' );
// on frontend area
add_action( 'wp_head', 'fb_move_admin_bar' );

Saturday, 2 November 2013

WordPress Style Admin Bar For Blogger


First of all, this is the most foolish Blogger widget on this entire blog. This widget is very useful but still a dumb idea from me.Still it's an awesome navigation bar for Blogger admins.

This widget is inspired from the WordPress Admin Bar menu and Blogger Admin Control Panel widget. This widget will be only visible to blog admins. It'll provide you some quick actions in the front end of your Blogger blog. Let's get started:

Locate Your Unique Blog ID Number:

To add this widget, it's important to find your unique blog ID number. It's really easy. Just open your Blog's dashboard (overview, posts, and backend other pages) and copy your unique blog ID from address bar.

For example, your ID will look something like this:


http://www,.blogger.com/blogger.g?blogID=1415638240907948#posts

Red part of the above URL is my blog ID. Visit your blog and copy your unique blog ID.

Add Admin Bar To Blogger Template:

To add the control panel to your Blogger template, go to Template > Edit HTML. Search and add following code just above </body>:

<style>
#wpadminbar {
    direction: ltr;
    color: rgb(204, 204, 204);
    font: 400 13px/28px sans-serif;
    height: 28px;
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100%;
    min-width: 600px;
    z-index: 99999;
    background: linear-gradient(to top, rgb(55, 55, 55) 0px, rgb(70, 70, 70) 5px) repeat scroll 0% 0% rgb(70, 70, 70);
}

#wpadminbar .quicklinks {
    border-left: 1px solid transparent;
}

#wpadminbar div {
    outline: 0px none;
}

#wpadminbar * {
    height: auto;
    width: auto;
    margin: 0px;
    padding: 0px;
    position: static;
    text-transform: none;
    letter-spacing: normal;
    font: 400 13px/28px sans-serif;
    color: rgb(204, 204, 204);
    text-shadow: 0px -1px 0px rgb(68, 68, 68);
    -moz-box-sizing: content-box;
    transition: none 0s ease 0s;
}

#wpadminbar {
    direction: ltr;
    color: rgb(204, 204, 204);
    font: 400 13px/28px sans-serif;
}

#wpadminbar .quicklinks ul {
    text-align: left;
}

#wpadminbar .ab-sub-wrapper, #wpadminbar ul, #wpadminbar ul li {
    background: none repeat scroll 0px 0px transparent;
    clear: none;
    list-style: none outside none;
    margin: 0px;
    padding: 0px;
    position: relative;
    text-indent: 0px;
    z-index: 99999;
}

#wpadminbar .quicklinks > ul > li {
    border-right: 1px solid rgb(85, 85, 85);
}

#wpadminbar ul li {
    background: none repeat scroll 0px 0px transparent;
        background-color: transparent;
        background-image: none;
        background-repeat: repeat;
        background-attachment: scroll;
        background-position: 0px 0px;
        background-clip: border-box;
        background-origin: padding-box;
        background-size: auto auto;
    clear: none;
    list-style: none outside none;
    margin: 0px;
    padding: 0px;
    position: relative;
    text-indent: 0px;
    z-index: 99999;
}
#wpadminbar li {
    float: left;
}

#wpadminbar .quicklinks > ul > li > a, #wpadminbar .quicklinks > ul > li > .ab-empty-item {
    border-right: 1px solid rgb(51, 51, 51);
}
#wpadminbar .quicklinks a, #wpadminbar .quicklinks .ab-empty-item, #wpadminbar .shortlink-input {
    height: 28px;
    display: block;
    padding: 0px 12px;
    margin: 0px;
}
#wpadminbar a, #wpadminbar a:hover, #wpadminbar a img, #wpadminbar a img:hover {
    outline: 0px none;
    border: 0px none;
    text-decoration: none;
    background: none repeat scroll 0px 0px transparent;
}

#wpadminbar .ab-top-secondary {
    float: right;
    background: linear-gradient(to top, rgb(55, 55, 55) 0px, rgb(70, 70, 70) 5px) repeat scroll 0% 0% rgb(70, 70, 70);
}

#wpadminbar .quicklinks .ab-top-secondary > li {
    border-left: 1px solid rgb(51, 51, 51);
    border-right: 0px none;
    float: right;
}
#wpadminbar ul li:last-child, #wpadminbar ul li:last-child .ab-item {
    border-right: 0px none;
    box-shadow: none;
}

#wpadminbar #wp-admin-bar-search .ab-item {
    background: none repeat scroll 0% 0% transparent;
}
#wpadminbar #wp-admin-bar-search .ab-item {
    padding: 0px;
}
#wpadminbar .quicklinks .ab-top-secondary > li > a, #wpadminbar .quicklinks .ab-top-secondary > li > .ab-empty-item {
    border-left: 1px solid rgb(85, 85, 85);
    border-right: 0px none;
}
#wpadminbar ul li:last-child, #wpadminbar ul li:last-child .ab-item {
    border-right: 0px none;
    box-shadow: none;
}

#wpadminbar #adminbarsearch {
    height: 28px;
    padding: 0px 2px;
}

#wpadminbar #adminbarsearch .adminbar-input {
    font: 13px/24px sans-serif;
    height: 24px;
    width: 24px;
    border: 0px none;
    padding: 0px 3px 0px 23px;
    margin: 0px;
    color: rgb(204, 204, 204);
    text-shadow: 0px -1px 0px rgb(68, 68, 68);
    background-color: rgba(255, 255, 255, 0);
    background-image: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj28b9E4prJNAbLzgGAVLnghfUUI68B9WpuPYgIA5eRH17OOV6miL_c29kKSoG7Nfq6j0XkDoYgfwp_JQjPN4KixsnU_fc-5o2UORtJLhrOzBENCn8gFoie_HCBkSvbgmwaRSPmqeOMVM/s1600/admin-bar-sprite.png");
    background-position: 3px 2px;
    background-repeat: no-repeat;
    outline: 0px none;
    cursor: pointer;
    border-radius: 3px 3px 3px 3px;
    box-shadow: none;
    -moz-box-sizing: border-box;
    transition-duration: 400ms;
    transition-property: width, background;
    transition-timing-function: ease;
}

#wpadminbar .ab-icon {
    position: relative;
    float: left;
    width: 16px;
    height: 16px;
    margin-top: 6px;
}

#wp-admin-bar-comments > .ab-item .ab-icon {
    background-image: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj28b9E4prJNAbLzgGAVLnghfUUI68B9WpuPYgIA5eRH17OOV6miL_c29kKSoG7Nfq6j0XkDoYgfwp_JQjPN4KixsnU_fc-5o2UORtJLhrOzBENCn8gFoie_HCBkSvbgmwaRSPmqeOMVM/s1600/admin-bar-sprite.png");
    background-position: -1px -134px;
    background-repeat: no-repeat;
}

#wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon {
    background-image: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj28b9E4prJNAbLzgGAVLnghfUUI68B9WpuPYgIA5eRH17OOV6miL_c29kKSoG7Nfq6j0XkDoYgfwp_JQjPN4KixsnU_fc-5o2UORtJLhrOzBENCn8gFoie_HCBkSvbgmwaRSPmqeOMVM/s1600/admin-bar-sprite.png");
    background-position: -2px -182px;
    background-repeat: no-repeat;
}

#wpadminbar a:focus, #wpadminbar a:active, #wpadminbar input[type="text"], #wpadminbar input[type="password"], #wpadminbar input[type="number"], #wpadminbar input[type="search"], #wpadminbar input[type="email"], #wpadminbar input[type="url"], #wpadminbar select, #wpadminbar textarea, #wpadminbar div {
    outline: 0px none;
}

#wpadminbar #adminbarsearch .adminbar-button {
    display: none;
}

#wpadminbar .ab-top-menu > li:hover > .ab-item, #wpadminbar .ab-top-menu > li.hover > .ab-item, #wpadminbar .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus {
    color: rgb(250, 250, 250);
    background: linear-gradient(to top, rgb(58, 58, 58), rgb(34, 34, 34)) repeat scroll 0% 0% rgb(34, 34, 34);
}
#wpadminbar .quicklinks > ul > li > a, #wpadminbar .quicklinks > ul > li > .ab-empty-item {
    border-right: 1px solid rgb(51, 51, 51);
}

#wpadminbar #adminbarsearch .adminbar-input:focus {
    color: rgb(85, 85, 85);
    text-shadow: 0px 1px 0px rgb(255, 255, 255);
    width: 200px;
    background-color: rgba(255, 255, 255, 0.9);
    cursor: text;
}
</style>

<span class='item-control blog-admin'>
<div id="wpadminbar" class="no-grav" role="navigation">   
            <div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="Top navigation toolbar." tabindex="0">
                <ul id="wp-admin-bar-root-default" class="ab-top-menu">
        <li id="wp-admin-bar-site-name" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://draft.blogger.com/blogger.g?blogID=BlogIdNumber#overview">BWidgets.com</a>        </li>
        <li id="wp-admin-bar-comments"><a class="ab-item" href="http://www.blogger.com/blogger.g?blogID=BlogIdNumber#comments" title="Moderate Comments"><span class="ab-icon"></span></a>        </li>
        <li id="wp-admin-bar-new-content" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://www.blogger.com/blogger.g?blogID=BlogIdNumber#editor" title="Add New"><span class="ab-icon"></span><span class="ab-label">New</span></a>        </li>
        <li class="menupop"><a class="ab-item" aria-haspopup="true" href="http://www.blogger.com/logout" title="Logout"><span></span><span class="ab-label">Logout</span></a>        </li>
       
       
        </ul><ul id="wp-admin-bar-top-secondary" class="ab-top-secondary ab-top-menu">
        <li id="wp-admin-bar-search" class="admin-bar-search"><div class="ab-item ab-empty-item" tabindex="-1"><form action="/search" method="get" id="adminbarsearch"><input class="adminbar-input" id="adminbar-search" name="q" value="" maxlength="150" type="text"><input class="adminbar-button" value="Search" type="submit"></form></div>        </li>
       
       
        </ul>            </div>
</div>
</span>

Replace all instances of BlogIdNumber with your unique BlogID. Save your template & that's it!

Friday, 1 November 2013

How To Add An Admin Control Panel To Blogger


Most of Blogger user hide the Blogger navigation bar in their blog. It's not a bad thing but takes a lot of quick links away from you. Those quick links are  “New post”, “Customize” and “Log Out.”

In this article, you'll know how to add an Admin Control Panel widget to your blog, which will be only visible to the blog admin. Thanks to BloggingTips for this awesome trick.

I added some extra options to the admin panel but you can add or remove them if you want to.

Locate Your Unique Blog ID Number:

To add this widget, it's important to find your unique blog ID number. It's really easy. Just open your Blog's dashboard (overview, posts, and backend other pages) and copy your unique blog ID from address bar.

For example, your ID will look something like this:

http://www,.blogger.com/blogger.g?blogID=1415638240907948#posts

Red part of the above URL is my blog ID. Visit your blog and copy your unique blog ID.

Add Admin Control Panel To Blogger Template:

To add the control panel to your Blogger template, go to Template > Edit HTML. Then search for the following line of code (or similar):

<b:section class='sidebar' id='sidebar' preferred='yes'>

Immediately before this line, paste the following section of code:

<span class='item-control blog-admin'>
<h2>Admin Control Panel</h2>
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#editor'>New Post</a>
|
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#posts'>Posts</a>
|
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#stats'>Stats</a>
|
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#settings'>Settings</a>
|
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#pageelements'>Change Layout</a>
|
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#template'>Edit HTML</a>
|
<a href='http://www.blogger.com/blogger.g?blogID=BlogIdNumber#comments'>Moderate Comments</a>
|
<a href='http://www.blogger.com/logout.g'>Sign Out</a>
</span>

Replace all instances of BlogIdNumber with your unique BlogID. Save your template & that's it!

Thursday, 31 October 2013

Stop WordPress From Compressing JPEG Images

According to some blogs, WordPress automatically compress your JPEG images to 90% quality, but this information is false.

This only happens on the resized images WordPress creates. The original uploaded image is saved unaltered, as the "full" size.

Anyways, you can stop compressing of JPEG images by putting following code into your functions.php file:

add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );

Google: How Fast Is Our Hummingbird


15 years have past since Google Search first appeared on the stage. Back in 1998 the searching process was far from perfection:  the huge machine called computer is on, the user type in keywords into the search system and the system manages to find several websites with the required information. Now it sounds funny, but at that time it was a miracle!

The whole process and the devices have changed since 1998. It is so easy to find billions of websites with one click on a tiny device in your pocket. Search systems are powerful, quick and very convenient. You can even ask the question in a loud voice and your inquiry will be satisfied. What else can be done here? Are there possible improvements? Google proves that there is always space for making changes and striving for better result.

New search algorithm from Google has got a beautiful name of a small but smart bird – the Hummingbird. It was presented on the press-conference dedicated to the 15th anniversary of Google.   The name for the new offspring was chosen in order to emphasize the accuracy and high speed of its work. The company said that changes in the search engine had been made a month ago and covered 90% of search queries, but the notification on the transition to the new search algorithm Hummingbird was decided to give on the 15th anniversary of Google. The press conference took place in the garage, where 15 years ago Sergey Brin and Larry Page had started a glorious history of  the search giant.

Amit Singhal, the head of Google's core ranking team, says that the current updated search algorithm is perhaps the most radical since 2001, the year he began to work in the company. Last major update search engine Caffeine was aimed primarily at increasing the speed of information indexing rather than the processing of the collected information. Hummingbird handles requests not only for keywords, but also according to their meaning. Thanks to this function, the inquiries made by users can be longer and more complex.

As the nature of inquiries has changed recently, the need to improve search algorithm appears. Earlier search inquiries were made in the form of short phrases with a large number of keywords. Today a user can make up search inquiries with the help of colloquial phrases, sometimes quite long and complex. The second reason, which made ​​it necessary to use a new search algorithm is the development of voice search. The time offers new standards, gadgets and approaches for search systems, that is why now is the right time for changes.

Tamar Yehoshua, vice president of the research department, demonstrated the abilities of new search algorithm to understand the associated inquiries. She offers Google to open photos of the Eiffel Tower, and immediately afterwards, without specifying what exactly she is talking about, asks questions: "What is its height?", "When was it built?", "Show me the photos of the building process". Next she presented the way voice search Google works offering to find information about the Impressionist painters.

Unfortunately, there is no way to compare the results of search system efficiency "before" and "after" the introduction of the new search algorithm. However, Google gives a few examples. For instance, request «acid reflux prescription» (acid reflux recipe) used to offer a list of medications that may be useless for users who sought for general information on the treatment and general information about the necessity to take medicine. The new algorithm offers the article containing this exact information.

Is it possible that the new search algorithm from Google made the search system worse? Hummingbird creators are sure that is unlikely, saying that they can’t approve that search system is better now, still, there are no evidences of dissatisfaction on the part of users. As everybody knows, people complain when they notice errors but they rarely see improvements.

Time will show how fast and smart Hummingbird is. A month after its start new algorithm justifies our hopes.

Author Author - Melisa Marzett is an experienced writer, she mainly works on such topics as internet innovations, web press and social media. Her articles are also available on best college paper writing service. It is easy to contact with Melisa on Google+
Join Us On:

Tuesday, 29 October 2013

Remove Author Prefix From Slug In WordPress


Earlier this month I shared an article about changing WordPress Author URL Slug. That code will change the default yoursite.com/author/name to yoursite.com/profile/name.

Now this trick will remove the author prefix from the author slug. To clarify, this snippet will help you turn: yoursite.com/author/name/ into: yoursite.com/name/.

Just add following snippet to your functions.php file:

// The first part //
add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules');
function no_author_base_rewrite_rules($author_rewrite) {
    global $wpdb;
    $author_rewrite = array();
    $authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users");   
    foreach($authors as $author) {
        $author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]';
        $author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]';
    }  
    return $author_rewrite;
}

// The second part //
add_filter('author_link', 'no_author_base', 1000, 2);
function no_author_base($link, $author_id) {
    $link_base = trailingslashit(get_option('home'));
    $link = preg_replace("|^{$link_base}author/|", '', $link);
    return $link_base . $link;
}

Props to WP-Snippet for this amazing tricks.

Detect And Redirect Android Users With .htaccess

Last night I shared a trick to redirect Android users to your Android/mobile website with a simple PHP snippet. It's time to do the same with .htaccess file. Android is the most used smart phone platform right now, and is a hot topic for developers.

Add this following code to your .htaccess file to redirect users with Android User Agent to a specific address:

RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$
RewriteRule ^(.*)$ http://android.yourwebsite.com [R=301]

Monday, 28 October 2013

Detect And Redirect Android Users With PHP

Here is a simple trick to redirect Android users with some simple PHP script. It's a useful snippet if you have an Android version of your website.

Add following PHP to your document to search and redirect Android user agents:

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($ua,'android') !== false) { // && stripos($ua,'mobile') !== false) {
    header('Location: http://android.yourwebsite.com');
    exit();
}

More tricks like this are on their way...

Allow Contributors To Upload Images In WordPress

Are you running a WordPress website with bunch of contributors who are willing to post on your website? If yes then this article contains a great tip for you.

As I mention on previous articles, every post on your blog must contain at least one image related to the article. It's really great for SEO and other things.

This code will help us to allow users with contributor role to upload images on your WordPress site.

Add this code to your functions.php file:

if ( current_user_can('contributor') && !current_user_can('upload_files') )
     add_action('admin_init', 'allow_contributor_uploads');
    
     function allow_contributor_uploads() {
          $contributor = get_role('contributor');
          $contributor->add_cap('upload_files');
     }

Thursday, 24 October 2013

How To Disable Smart/Curly Quotes In WordPress

There are lot of word processor programs which itself converts all yours simple quotes to curly quotes (aka s mart quotes). It looks like small figures six and nine raised above the baseline (like 6...9 and 66...99).

It's a huge problem if you're writing codes in your posts as WordPress automatically converts all quote symbols to smart quotes. So if anyone is copying a snippet from your blog post would have problems with running to code in their own text file.

You can easily disable this feature with a small snippet. Just add following snippet to your functions.php file:

<?php
remove_filter('the_content', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
?>

That's it!

Wednesday, 16 October 2013

Send Email Notifications When User Submit A Post In WordPress

Are you running a multi-author WordPress blog or a blog with guest posters with contributor role to submit the post directly from the WordPress dashboard? Then you must be looking for a way to get email notification when someone submit a post or when you publish or reject their post.

We previously shares some great scripts to get email notifications for a couple of events, but this time it's a plugin.

WP Status Notifier is all you're looking for!

The plugin sends an email to the admin (or selected user) when ever some one submit a post for review and when you publish or reject their post, author will get instant emails. After installing the plugin, you can access it’s setting under Settings > Post Status Change Notifications.

WP Status Notifier's interface is not much complicated, as you can check it below:


It's a great plugin, but if you want some advance options, then you can also use Post Status Notifier Lite.

Personal Note: First of all, Eid-Mubharakh to all my Muslim readers. I'm going out on a small seven day trip tomorrow, so don't expect me to post any articles here on BWidgets. Thanks for all your support!

Popular Posts

 
Powered by Blogger.