How To Fix – There Is No Attribute “allowTransparency”

If you are getting a message ‘There is no attribute allowTransparency‘ while validating your site with W3C Validator then this post is for you.

If you are using document type XHTML Transitional then maybe i can solve your problem. The attribute allowTransparency belongs to iframe. So we will be taking up a short code containing iframe tags with the attribute allowTransparency in it.

The best example would be Facebook Like Box, because most blogs and websites use it and it fails to validate with W3C Validator.

The code for Facebook like box with Page Username Codefap is given below –


<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fcodefap&amp;width=292&amp;height=290&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;border_color&amp;header=true&amp;
scrolling="no" frameborder="0" style="border:none;
overflow:hidden; width:292px; height:290px;" allowTransparency="true">
</iframe>

But this code fails to validate for the only reason that it contains allowTransparency attribute. And this can be simply fixed by replacing the code given above with the following code –


<!--[if IE]>

<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fcodefap&amp;width=300&amp;height=290&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;border_color&amp;header=true&amp;
scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:270px;" allowTransparency="true">
</iframe>

<![endif]-->

<!--[if !IE]>-->

<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fcodefap&amp;width=300&amp;height=290&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;border_color&amp;header=true&amp;
scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:270px;" >
</iframe>

<!--<![endif]-->

We have written two codes for the Facebook Like Box – One with allowTransparency with if statement for IE and other one without it. And this solves the problem. By using this embed code with conditional HTML elements, you can validate your site properly even after using allowTransparency attribute on the web page.

Manually Reset WordPress User Password Using PhpMyAdmin

It is important that you should know how to reset WordPress user password by editing the database. If  – 1) you forget wordpress account password, 2) your wordpress account gets hacked, 3) you cannot reset wordpress password by e-mail – then this post can be very useful.

I had once forgotten my user password for a local WordPress installation based on WAMP Server. I had a clue that i can reset the password by using phpmyadmin but even though i tried, it just didn’t work.

In this post i will tell you why it didn’t work and also how to get it to work. First of all you must know how to access phpmyadmin

If you are using WordPress local installation based on WAMP Server then you can find phpmyadmin just by visiting the URL given below.

http://localhost/phpmyadmin/

But if you are using CPANEL hosting, then you can find phpmyadmin just in the databases category as shown below.

phpMyAdmin in CPANEL

Note – If you are an advanced user, you can just follow this article by referring to images plus bold red/green text instead of spending too much time reading every line.

#1) Once you open phpMyAdmin, just Select Databases from top left corner and you will get a screen similar to the one given below.

Select A Database

#2) All you need to do is Select the Appropriate WordPress Database. In this case, I am selecting cflocal which is used by my local WordPress installation. After doing so, you will get the next screen as shown below.

Select wp_users

#3) Now Select wp_users to edit users table.

Edit Users Table

Since my local WordPress installation has just one user named admin, you can only see one row. But if you have several users then you will get multiple rows here.

#4) Just hit the edit button next to the user upon which you want to perform the reset password operation. This will show up the next screen given below.

Edit User Pass Window

Here you can see the user_pass row has a weird set of characters as the value. This is just for security reasons.

Note: If you try to set a new password by entering a new value and hitting go button, then it just wont work. Because you need to set a MD5 value instead of normal value.

#5) Enter a new password value in user_pass row and select Md5 Function from drop down menu as shown below.

MD5 Password WordPress

#6) Now just hit the Go button and you are done. Your password will be reset.

If it doesn’t work or if you have any doubts then feel free to comment below. And do subscribe to blog feed for more amazing posts. Thanks.

How To Detect Homepage In WordPress

Sometimes you might want to detect whether the current WordPress page is home page or not. This can be helpful if you want to display/hide certain content of your blog. For example – hide advertisements on home page, display a welcome message, etc.

Now there are different ways to do this. I’ll try and explain all of these in this post.

WordPress has two inbuilt functions is_home() and is_front_page() which can help you to detect homepage in WordPress. Lets understand how to use them –

is_home()

If you are not using a static home page, then this is the function which can help you to detect whether the current page is home page or not. You can use the code given below to display content only on homepage and hide from all other pages.


<?php if (is_home()) { ?>

HTML CODE HERE

<p> example html </p>

<?php } ?>

is_front_page()

If you are using a static home page then instead of is_home() function, you have to use is_front_page() function. And the code to detect home page is given below.


<?php if (is_front_page()) { ?>

HTML CODE HERE

<p> example html </p>

<?php } ?>

Problem with Widgets

The is_home() and is_front_page() might not work well if you place them or use them inside the widgets or widget functions. And to solve that we can just get rid of WordPress functions and directly use URI (Uniform Resource Identifier) check method as given below.

Direct URI Check

Instead of WordPress methods, I’d recommend you guys to use the code given below.


if ( $_SERVER["REQUEST_URI"] == '/' )
{
/* do something */
}

Just replace line number 3 with your desired code. This code works reliably well on all WordPress pages. I hope this works out for you guys. If you have any doubts feel free to comment below.

And for more amazing posts, Subscribe to Blog Feed.