Nabtron Technology & Programming Guide Wed, 30 Jul 2014 18:42:18 +0000 en-US hourly 1 is_single not working in functions.php wordpress [Solved] Wed, 30 Jul 2014 17:29:06 +0000 wordpressI’ve been trying to add a condition for is_single() in my WordPress themes functions.php to show ads on blog posts only and not on other pages. However, the condition, if(is_single()){} wasn’t working as expected, i.e, it wasn’t returning positive for single post page too and thus failing again n again.

Upon investigating and playing around, the solution was that the condition has to be used inside a function and not in the functions.php file openly.

Take the following example which I used for my theme code to show adsense on single post page only and not on wordpress is_page() pages.

This is incorrect way of using wordpress conditional hooks (outside functions in functions.php)

if(is_single()) {

add_action(‘the_content’, sharebox);


function sharebox($content){

$nabtron_before_content = “stuff to show before content”;

$nabtron_after_content = “stuff to show after content”;

$content = $nabtron_author_adsense.$content.$nabtron_after_content;


This will not work, as the condition for checking if the page is a single post or a wp page is not inside a functions.

This is correct way to use conditional is_single() or any other in functions.php 

To use the conditional function correctly inside functions.php, add it inside a function like this and it will work inshaAllah:

add_action(‘the_content’, sharebox);

function sharebox($content){

if(is_single()) {

$nabtron_before_content = “stuff to show before content”;

$nabtron_after_content = “stuff to show after content”;

$content = $nabtron_author_adsense.$content.$nabtron_after_content;



Let me know if you have any queries or suggestions related to it!

]]> 0
Show code on Single Post page only – WordPress Wed, 30 Jul 2014 13:46:58 +0000 While working on wordpress, there might be something you wanna show on your single post page only and not on every content page of your wordpress blog or website.

wordpressThis can be done by using builtin is_single() function of wordpress. Showing ads (adsense ofcourse ?) on your single post page only and not on other pages like contact or about us.

Well I’ve been trying to put the code in functions.php of my wordpress theme to add the adsense code before and after my blog post but not to show it on regular pages of the website.

To do this, the code theme has to go like this in functions.php file of your wordpress theme:

add_action(‘the_content’, sharebox);

function sharebox($content){

if(is_single()) {

$nabtron_before_content = “stuff to show before content”;

$nabtron_after_content = “stuff to show after content”;

$content = $nabtron_author_adsense.$content.$nabtron_after_content;



Please note, that “is_single()” check has to be inside the function to work, it won’t work outside of it on the add_action line.

This will simply add your stuff to show before content , before the main content body, and the stuff to show after content will be displayed after the content. You can add ads code here or any other code.

Please note that the WordPress built in function “is_post()” is now deprecated and will trigger an error saying that call to an undefined function or similar one.

Let me know if you have any other ideas or if you have trouble with this thing :)

]]> 0 – The publisher interface might be down.Try again after some time. Wed, 30 Jul 2014 10:51:04 +0000 I’ve been trying to login my account to see if my earning has an increase of any cent or penny in last 1 month (that’s the maximum I earn through it on one of my site ! ) but I keep on getting this error that the publisher interface might be down

The publisher interface might be down.Try again after some time.

media net The publisher interface might be down Try again after some timeNow this is weird. The admin panel for users / publishers is down for many hours now! Is it that they’re upgrading something? ( which would be a good news! ) or else it’s just routine error :/

How is it coming along at your side ?


Now isn’t loading at all. Few minutes earlier it was giving and error saying “Request timeout” (the server timed out while waiting for the browser’s request. Reference #2.3555c817.1406743271.0:

media net request timeout


]]> 0
Viber Wishes “Happy Eid Al-Fitr” to Muslims via message Tue, 29 Jul 2014 12:18:53 +0000 I just received a message to my viber inbox from Viber itself (weird, never got any such message before from the company itself) wishing me a Happy Eid Al-fitr.

happy eid viber

Viber, a jewish company, jews who’re bombing the Muslims of Gaza, even on the day of Eid, are wishing them Eid ! wow!

I wonder what trend they’re setting ? maybe all the bombing in last month and the Eid day was all part of the celebrations of Eid ? bombs were just meant to be gift to the Muslims ?

I #supportgaza! do you?

]]> 0
iPhone 5 not charging [solved] Tue, 22 Jul 2014 10:18:05 +0000 iPhones are amazing, specially iPhone 5. They changed the charger for the new iPhone 5 too to lightening charger. However, this didn’t solve the issue of charger getting bad or iPhone refusing to charge!

The iPhones chargers are really unreliable and I have to always keep a spare charger with me so that I am ready to coup with the situation in which my iPhone 5 is not charging with the default charger.

iphone 5 not chargingThe iPhone 5 not charging problem starts usually with an indicator saying “This accessory is not recognized”. This stops the charging.

In this article we will discuss a few ways to solve the iPhone 5 not charging issue which you might be having with your iphone 5 charger. Before we proceed, make sure that it’s not the iPhone 5 slot or batter which is causing issue and it’s the iPhone 5 charger faulty causing issues.

This could be very frustrating when your iPhone 5 charger stops working. iPhones battery don’t last long already so any fault in charger will lead to a nightmare. Other than the solutions to solve it, it’s always recommended to keep a spare charger or two for your iPhone 5 with you.

If your iPhone isn’t charging, may it iPhone 5, iphone 5c, iphone 5s or previous versions of iphone like iphone 2g, iphone 3g, iphone 3gs, iphone 4 or iphone 4s, follow these troubleshooting steps to solve the iphone not charging issue.

iPhone 5 not charging – How to fix

1. Restart your iPhone 5 – Hard Restart

You can try both restarts, the simple one and the hard one.

Simple one is when you press the power button and it shows the power off slider, slide it to power off and then re press the power button to turn on the iPhone 5.

Hard restart is when you press power and home button until it restart itself.

Make sure that the charger is connected when you do the hard restart.

2. Turn off the iPhone 5 and then charge

Turn off the iPhone 5 and then connect the charger, it usually works with partially faulty chargers whose current flow is intact but data isn’t probably.

3. Turn iTunes on / off and charge

Test by once connecting the charger when itunes is on on your computer and then once when it’s off. It might work one way or the other and your iphone 5 might start charging.

4. Clean the line on iphone 5 charger slot and retry

If resetting your iphone 5 didn’t get it charging again, better to check if the charger port of the charger itself is dusty and has lint.

Blow strongly to clean the iphone 5 charger slot, charger itself, usb slot and the usb slot.

Once done, reconnect the charger to the iphone through computer. If that don’t work either, connect it with the wall charger. Try using any other computers usb port to see if your computer port is faulty and thus not charging your iphone 5.

5. Cross test with another iPhone 5

If you tried the above steps but they failed, try using the same charger with some other iPhone 5 to see if that the charger is fine or not. Once confirmed that the charger is fine, there might be the issue with your iPhone 5 charger slot or battery / circuit.

6. Change the iPhone 5 battery

If the charger is fine but the problem is with your iPhone 5 battery, then better get a replacement battery and change your iPhone 5 battery.

7. Buy a new iPhone 5

Very much self explanatory!

Hopefully this will get your iphone5 not charging issue solved! This might work with all previous versions of iPhones and iPad too!

]]> 0
Facebook not sending Login approval sms – confusion solved Mon, 07 Jul 2014 18:33:07 +0000 This post might seem off topic or sort of too much of common sense, but some people are still having difficulty in crossing this step of facebook login approval when logging into facebook from new browser on their computer.

When logging in on your facebook account for which you have turned on login approvals from your computer, facebook asks you to enter a code on the very next page when you login.

Screen shot 2014-07-07 at 6.45.21 PM

As you can see, it asks you to enter the security code from your code generator which is in your smart phone.

People might get confused that what should they enter, when they haven’t received the text with code from facebook, well this is not the input box for any sms code, so Facebook hasn’t sent the sms yet. If you read “carefully” this is the login box which allows you to enter the code generated from your mobile / smart phone running Facebook already and logged in with same account which you’re trying to login here on your computer. In the settings you can find the code generator.

However, if you want Facebook to send you the approval code sms, you have to click “Can’t find your code?” and it will open a popup which looks like this:

Screen shot 2014-07-07 at 6.45.43 PM

Instead of getting confused with the given details and options, simply click “Text me a security code” and Facebook will send a security code to your mobile phone number which you added earlier while turning on the Login approvals in security settings.

Hope this helps! :)

]]> 0
How to get WordPress current post author ID and other details Mon, 07 Jul 2014 08:39:14 +0000 wordpressYesterday while coding a function to show different adsense code for different author, I needed to find the author ID of that post to show the relevant google adsense code with it. The issue was solved by the wordpress builtin function get_the_author_meta.

The official reference page for get_the_author_meta function for wordpress says that it has to be used within the loop. Well let me make it clear here that this doesn’t mean that whole code has to be there. You can place the code in functions.php and call it within the loop. I used it entirely within the functions.php and added the adsense code before the content.

The get_the_author_meta function gives you various details of the author of particular post including his id, email, username and so on.

However, it don’t publish it directly, to echo or print the author meta you have to use the_author_meta function and it will echo it directly.

The function works like this:

<?php $user_email = get_the_author_meta('user_email'); ?>

You can use ID, nickname, first_name and other parameters too. For details check the get_the_author_meta functions page on WP Reference

]]> 0
How to secure your Facebook account with Mobile text verification / Login Approvals Sat, 05 Jul 2014 13:27:07 +0000 There are numerous accounts of Facebook accounts being hacked and misused. Facebook provides you an option to add mobile text verification to your account to enhance its security. Facebook calls it “Login Approvals” which asks user to verify it’s authority on the account before logging in.

How it works:

Once the mobile text verification for facebook has been setup, it will work like this on your login:

1. you goto and login with your id and password

2. facebook stops the login process in between and sends a text to your mobile number with a security text or pin.

3. you enter that pin on that facebook page and continue with the login.

So this way, only the person who has access to that mobile phone number or sim can login to your account.


Make sure that the mobile number which you’re giving to be used for this purpose of text verification by facebook is yours and is in your own name. Because there is no way to login to your account if you lose access to your mobile number!

How to setup Facebook Mobile text verification / Login Approvals

1. Login to your facebook profile

2. make sure that the number you want to add is in your own name, so that if you miss the sim or some issue arises, you can get the new sim card yourself.

3. Goto your facebook profile, top right corner is a “lock” icon next to home , friend requests, messages, notification, click on it

Screen shot 2014-07-05 at 10.56.33 AM

4. On this popup, click “See More Settings” to goto the main settings page

5. On settings page, left menu, click “Security”. On the security settings page, we have to do three things. Turn on Login notifications, login approvals and clear the Trusted browsers list and start from new browser.

Screen shot 2014-07-05 at 6.01.19 PM

6. First of all we setup Login Approvals, hover (take mouse over) Login approvals and click on it (or the edit button link which appears). It lets you use your phone as an extra layer of security to keep other people from logging into.

Screen shot 2014-07-05 at 6.02.08 PM

7. Click login Approvals will open a popup which will explain you how to proceed with setting up login approvals. Please note this is “one” thing we’re doing here, we have to make 2 more changes once login approvals are set up.

Screen shot 2014-07-05 at 6.02.53 PM

8. One login approvals are setup, we have to setup login notifications on the same security settings page. Click on Login Notifications and turn on mobile / text notifications (and email if you want to) and save changes.

Screen shot 2014-07-05 at 6.04.28 PM

9 Now on the same page, second last option, click on “Trusted Browsers”. It will open the list of all the browsers that are saved with Facebook Server. Remove “ALL” of them. This is very important step otherwise those people who logged in once from your computer will be able to access it again without login approvals.

Screen shot 2014-07-05 at 6.03.55 PM

10. Done, once removed them and security setup on the correct number and verified, your account is now much much secure than it was before!

]]> 0
How to Remove your cell number from Facebook profile Sat, 05 Jul 2014 06:26:20 +0000 Most of the facebook settings are not straight forward and scare its users. Cell phone number is one of them. User might add phone number while doing “something” on facebook or any other associated application from their cell phone probably which will add cell number to their profile, but then boom, that cell number goes either public or visible to all their friends.

Now the settings might be obvious to few, but they are really confusing for many facebook users and this results in misuse of their numbers and getting calls and texts from people they don’t know! So in this post we will discuss how to remove your mobile number from facebook, or atleast make it “invisible” to everyone on facebook.

How to remove your mobile number from Facebook Profile – About page

1. Login to your facebook profile.

2. Goto your profile timeline page (Click on your name on top right, next to “home” button)

Screen shot 2014-07-05 at 11.00.52 AM

3. One in your profile, click “About” to go to your facebook profile about page

Screen shot 2014-07-05 at 11.07.44 AM

4. On About page, go down to “Contact Information” section. There, take the mouse cursor on your cell phone number and it will highlight and show a “edit” icon next to it like following picture, click on that edit icon:

Screen shot 2014-07-05 at 11.09.21 AM

5. This will open up the mobile phones settings editing panel. Click on the privacy icon next to the desired mobile phone number that you want to be hidden. It will open up list of options for privacy of that number like this:

Screen shot 2014-07-05 at 11.18.16 AM

6. Select “Only Me” if you want it to be hidden from everyone or any other settings if you intend to do so!

7. Click Save Changes. Facebook will ask for your password to confirm.

8. Once done, make sure that there is “lock” next to your cell phone number in the Contact Information section of your Facebook About page. You can take your mouse over the icon to see if it says “Only Me” for confirmation.

Screen shot 2014-07-05 at 11.21.43 AM

Voila you’re done! I hope it helps you keep your personal contact number from getting public :)


]]> 0
How to appear offline on Facebook chat Fri, 20 Jun 2014 09:37:21 +0000 Most of us are online on facebook almost all the time, while eating, while working, while sleeping, while this while that! but not all the time we’re in a mood or capacity to talk to the online friends. Facebook allows you to appear offline.

Appear offline feature allows you to either become offline for all of your contacts on facebook or to appear offline to specific friend of a group in your facebook profile.

How to appear offline to Everyone on Facebook Chat

To appear offline to everyone on your facebook contact list, simply click the settings wheel icon at the bottom right corner of your facebook window.

It will open a list of options, select : “Turn off Chat” from the options (see image below)

appear offline on facebook

This will make you appear offline for all your friends in your facebook friendlist.

Please note, this will make you appear offline from your computer, however if you’re logged in from your cell phone too you will need to turn off chat from the cell phone too!

How to appear offline to specific group or friend on Facebook chat

If you want to appear offline to specific group of people or some specific friend in your facebook profile friendlist, simply follow the same initial steps of clicking the settings wheel on the bottom right corner of your facebook page window and from the list, select “Advanced Settings…” instead.

Screen shot 2014-06-20 at 2.35.40 PM

This will open a popup which lets you appear offline for specific groups you have on facebook or some specific person.



]]> 0