Auto resize iframe
Example code for auto resize an iframe: <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js”></script> <script> $(document).ready(function(){ $(‘iframe’).load(function() { this.style.height = this.contentWindow.document.body.offsetHeight + ‘px’; }); }); </script>
“Add to Bookmark” Script
For add bookmark script on your page, just place following function anywhere on your page: <script type=”text/javascript”> function addBookmark(title,url){ /** * Check if its FFX */ if (window.sidebar) window.sidebar.addPanel(title, url, “”); else if(window.opera && window.print){ /** * Think its opera */ var elem = document.createElement(‘a’); elem.setAttribute(‘href’,url); elem.setAttribute(‘title’, title); elem.setAttribute(‘rel’,’sidebar’); elem.click(); …
How to use Twentyten theme as custom theme!
Twenty-Ten, a default theme for wordpress, is really a simple and good theme. It mostly happens that you need to make changes in default Twentyten theme LIKE Change the width of the sidebar, change the menu text spacing etc. When that kind of changes are required, what most of developers …
Stop textarea elements from being resizable in Mozila 4.0
In mozila 4.0, i noticed that each textarea becomes resizable. No doubt, its really a nice feature. But some times we need to avoid it. Its very easy to stop resizable feature from textareas. Just place following code in your css file: textarea {resize:none}
wp_nav_menu First and Last Classes
wp_nav_menu allows you to show navigation in the front-end. This simple function picks the menu defined in the wp-admin dashboard and displays it as the list. You can define menu separator using “link_before, link_after” or “before, after” params. But the common problem with this function is that sometimes we need …
Getting Rid of Vertical Scrollbar from FB iframed pages
When working with FB iframed pages, Sometime the height of content area, you are going to show on FB pag, can need more than 800 pixels. But default height for Facebook’s iFramed pages is 800 pixels. This causes a vertical scrollbar on FB page. To get rid of this type …
Remove hashtag from URL when using prettyPhoto!
PrettyPhoto, a jQuery lightbox clone, supports image galleries, Flash content, video (including YouTube and vimeo) and embedding external websites using iframes. No doubt, it is really a very simple and flexible plugin which is compatible with all major browsers including IE6. But if one will see it adds a hashtag …
Remove Parent Categories from URL
How to remove the parent category from the url with WordPress 3.1? One way is, Just paste the below one code in your functions.php : add_action( ‘init’, ‘build_taxonomies’, 0 ); function build_taxonomies() { register_taxonomy( ‘category’, ‘post’, array( ‘hierarchical’ => true, ‘update_count_callback’ => ‘_update_post_term_count’, ‘query_var’ => ‘category_name’, ‘rewrite’ => did_action( ‘init’ …
Track the user who deauthorizes your FB app
Sometimes we may need to track which users of our facebook application are removing the application from their application setting. For this: – Go to your current app setting page. One way to list your all apps is visit https://www.facebook.com/developers/apps.php – Now in the application setting in the advanced tab, …
Auto Login to wordpress
Sometimes, in wordpress, what we need is to make a user auto log in. Solution for this is very simple. Just put the following code in your functions.php :- function auto_log_me_in($user_login) { $user = get_userdatabylogin($user_login); $user_id = $user->ID; wp_set_current_user($user_id, $user_login); wp_set_auth_cookie($user_id); do_action(‘wp_login’, $user_login); } Now call auto_log_me_in($user_login); where you want …
