Sunday, December 19, 2010

20 Plugin Replacing Tutorials, Tips, Snippets and Solutions for Wordpress | Speckyboy Design Magazine

20 Plugin Replacing Tutorials, Tips, Snippets and Solutions for WordPress

December 9, 2010 - 19 CommentsWritten by Paul Andrew
Categories → Web Design,Wordpress
  • Bookmark on Delicious

  • Digg This

  • Stumble This

  • Share on Reddit

  • Google Buzz

  • FriendFeed

Create a free website

It is no secret that there is an endless supply of plugins that will make WordPress highly extensible, its one of the main reasons why WordPress is so popular amongst developers. They give endless potential to the most basic installation and with wisely chosen plugins will very easily transform WP into a very powerful application.
But, do we really need to use plugins for the most common and basic tasks, like installing Analytics or re-directing your feed to Feedbuner? Or, do we really need plugins for pagination, contact forms or even a content slider? Of course not. There are better and in some cases simpler solutions, as we will show you in this article.

There are many benefits to not using plugins: You will have more control over customization and functionality, you can make WordPress faster and uncluttered, and most importantly, you will be able to reduce potential security risks. On top of all these reasons, there really is no greater satisfaction than coding everything yourself.

In this article we have taken 20 of the most popular plugin uses and offer a plugin-replacing solution, via either a code hack, tutorial or a simple tip.

WordPress & jQuery Contact Form without a Plugin

WordPress & jQuery Contact Form without a Plugin


There are many contact form plugins, most are overbloated with an endless list of features and addons. Wouldn’t it be nice to just have a basic contact form and be given control over the markup?
With this tutorial you will create a custom page template with a contact form and finally, adding a little jQuery to improve the form. You can download the source files, so it should be very easy to tweak and implement.
WordPress & jQuery Contact Form without a Plugin →View the Demo →

WordPress Post Pagination without a Plugin

WordPress Post Pagination without a Plugin


Using a plugin for post pagination may be a little bit of overkill since you really only need to add a few lines of PHP and CSS to your theme, and this easy to follow tutorial will walk you through the process.
WordPress Post Pagination without a Plugin →View the Demo →

Featured Post Section In WP (And Get Pagination To Work)

Featured Post Section In WP And Get Pagination To Work


A common trend with WordPress themes is to have featured post box on the homepage, sorta like a kind of like a post that stays there till you replace it with another featured post. This tutorial will show you how to build your own featured post section and you can also download the sample php files.
>Featured Post Section In WP →

Popular Posts Page without a Plugin

Popular Posts Page without a Plugin


There are many different ways you can do this, and quite a few plugins that can help as well. This tutorial will show you how to build a popular posts page based on the number of comments from each post. As well as showing you how to create a popular post apge, this tutorial will also show you how to create a popular posts widget for the sidebar.
Popular Posts Page without a Plugin →

Add Social Bookmarks to your WordPress Theme

Add Social Bookmarks to your WordPress Theme


In this short tutorial, you'll learn how to add buttons to our WordPress theme that will allow visitors to easily submit the current article to social bookmarking sites like Delicious, Reddit, Digg, StumbleUpon, Twitter and Facebook, all without a plugin.
Add Social Bookmarks to your WordPress Theme →

Random Posts Without a Plugin

Random Posts Without a Plugin


If your WordPress blog uses a home page or a landing page of some kind it can be pretty useful generating a random post that will hopefully grab your visitors attention. This short tutorial will show you exactly how to do it.
Random Posts Without a Plugin →

WordPress Breadcrumbs Without a Plugin

WordPress Breadcrumbs Without a Plugin


There are, of course, a number of ready made plugins for creating WordPress breadcrumbs, but if you prefer to use short code snippets, this tutorial will point you in the right direction.
WordPress Breadcrumbs Without a Plugin →

Automatic WordPress Thumbnail Without Custom Field or Plugin

Automatic WordPress Thumbnail Without Custom Field or Plugin


A lot of blogs effectively show thumbnails on the frontpage or archives, accompanied by the title and excerpt, they do tend to bring more life to the content.
The only problem though is that using custom fields can be complicated and time-wasting. This post will show you how to make your theme generate thumbnails automatically, based on your post’s first image.
Automatic WordPress Thumbnail Without Custom Field or Plugin →

Related Posts without a Plugin (Basic Method)

Displaying related posts is a very great way to get visitors to stay longer on your blog. You could use a plugin, but to make things even easier you could use this snippet:

<?php $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;  $args=array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'showposts'=>5, // Number of related posts that will be shown. 'caller_get_posts'=>1 ); $my_query = new wp_query($args); if( $my_query->have_posts() ) { echo '<h3>Related Posts</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <li></li> <?php } echo '</ul>'; } } ?>

Source →

Related Posts with Thumbnail without a Plugin (Advanced)

This code snippet does not simply display a list of links, but builds a list of images (thumbnails) instead:

<?php $backup = $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;  $args=array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'showposts'=>5, // Number of related posts that will be shown. 'caller_get_posts'=>1 );  $my_query = new wp_query($args); if( $my_query->have_posts() ) { echo '<h3>Related Posts</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?>  <li><?php the_title(); ?></li>  <?php } echo '</ul>'; } } $post = $backup; wp_reset_query(); ?>

Source →

Show Number of Retweets in WordPress Without a Plugin

Show Number of Retweets in WordPress Without a Plugin


Showing how many people are talking about your article on Twitter can encourage more people to talk about it. Its commonly achieved with a plugin, but using the code from this tutorial is much, much easier.
Show Number of Retweets in WordPress Without a Plugin →

Display Your Tweets without a Plugin

Display Your Tweets without a Plugin


There are some rather hefty plugins you could use to display your recent Tweets, but with this tutorial you will be shown how to display them using only 3 lines of code.
Display Your Tweets without a Plugin →

Feedburner Count And Twitter Followers Without Chicklets

Feedburner Count And Twitter Followers Without Chicklets


Feedburner offers a great chicklet which allows you to add your subscriber count to your site, and for Twitter you can use a chicklet to display your followers from a service such as twittercounter.com. What you will be shown in this tutorial is a method of displaying these counts without actually using a chicklet which will allow you to customise how your stats will be displayed.
Feedburner Count And Twitter Followers Without Chicklets →View the Demo →

Highlight Searched Text in Search Results

Open your search.php and find the_title() code and replace it with echo $title;. Then before that code you need to put this code:

<?php $title     = get_the_title(); $keys= explode(" ",$s); $title     = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="search-excerpt"></strong>', $title); ?>

Source →

Install Google Analytics without Using A Plugin

Using a plugin is the most common method for installing Google Analytics. An even easier way is to simply install Google’s supplied code into your theme’s footer file. That’s it, no plugin, done and move on. This video will show you how:

Source →

How To Insert Google Maps into WordPress without a Plugin

This code snippet will allow you to display Google Maps on your site using a WP shortcode. First of all copy this code here is the code:

//Google Maps Shortcode function do_googleMaps($atts, $content = null) { extract(shortcode_atts(array( "width" => '640', "height" => '480', "src" => '' ), $atts)); return ''; } add_shortcode("googlemap", "do_googleMaps");

Here is the short code you can use (replace [you_url] with your Google Maps Link:

[googlemap width="200" height="200" src="[you_url]"]

Source →

Link to External Links from the Post Title

This custom field hack allows you to link to an external resource from the post title, meaning when a user clicks on the post title, it takes them to another article. Paste this snippet into your functions.php:

function print_post_title() { global $post; $thePostID = $post->ID; $post_id = get_post($thePostID); $title = $post_id->post_title; $perm = get_permalink($post_id); $post_keys = array(); $post_val = array(); $post_keys = get_post_custom_keys($thePostID);  if (!empty($post_keys)) { foreach ($post_keys as $pkey) { if ($pkey=='url1' || $pkey=='title_url' || $pkey=='url_title') { $post_val = get_post_custom_values($pkey); } } if (empty($post_val)) { $link = $perm; } else { $link = $post_val[0]; } } else { $link = $perm; } echo '<h2>'.$title.'</h2>'; }

Source →

Automatically Resized Images

This script will replace the uploaded image (if bigger than the larger size defined in your settings) by the large image generated by WordPress to save space in your server, and save bandwidth if you link a thumbnail to the original image:

function replace_uploaded_image($image_data) { // if there is no large image : return if (!isset($image_data['sizes']['large'])) return $image_data;  // paths to the uploaded image and the large image $upload_dir = wp_upload_dir(); $uploaded_image_location = $upload_dir['basedir'] . '/' .$image_data['file']; $large_image_location = $upload_dir['path'] . '/'.$image_data['sizes']['large']['file'];  // delete the uploaded image unlink($uploaded_image_location);  // rename the large image rename($large_image_location,$uploaded_image_location);  // update image metadata and return them $image_data['width'] = $image_data['sizes']['large']['width']; $image_data['height'] = $image_data['sizes']['large']['height']; unset($image_data['sizes']['large']);  return $image_data; } add_filter('wp_generate_attachment_metadata','replace_uploaded_image');

Source →

Customize WordPress Login Logo without a Plugin

The only thing you have to do is to copy the following piece of code, and paste it on your functions.php file:

function my_custom_login_logo() { echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.gif) !important; } </style>'; }  add_action('login_head', 'my_custom_login_logo');

Source →

Valid, SEO-Friendly Post Translation without a Plugin

Valid, SEO-Friendly Post Translation without a Plugin


Ever wanted to provide automatic language translations of your web pages without installing another plugin? Here is a valid, SEO-friendly technique that takes advantage of Google’s free translation service.
Valid, SEO-Friendly Post Translation without a Plugin →

Deny Comment Posting to No Referrer Requests (Anti-Spam)

If you’re a WordPress user, then you’re probably upset with the amount of daily spam comments. Sure, there’s akismet, but here’s a little .htaccess trick to prevent spammers posting on your blog. Paste the following code on your .htaccess file:

RewriteEngine On RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .wp-comments-post\.php* RewriteCond %{HTTP_REFERER} !.*yourblog.com.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Source →

Redirect WordPress Feeds to Feedburner via htaccess

Here is the consolidated (comment & content) .htaccess code to redirect your feed to Feedburner:

# temp redirect all wordpress feeds to feedburner <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI}      ^/?(feed.*|comments.*)        [NC] RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC] RewriteRule ^feed/?.*$          http://feeds.feedburner.com/perishablepress         [L,NC,R=302] RewriteRule ^comments/?.*$      http://feeds.feedburner.com/perishablepresscomments [L,NC,R=302] </IfModule>

Source →

Helpful and Effective WordPress Archives

Helpful and Effective WordPress Archives


There are a number of plugins that will create an effective Archives Page for you (like ours, we are using Clean Archives Reloaded), but should you want to create your own this tutorial will show you how.
Helpful and Effective WordPress Archives →

How to: Add “del” and “spam” buttons to your comments

With this snippet you will be able to mark a comment as spam, or even delete it, from your blogs front-end. Paste this code into your functions.php:

function delete_comment_link($id) { if (current_user_can('edit_post')) { echo '| del '; echo '| spam'; } }

Then, add the following code to the comments.php were you want it to appear:

delete_comment_link(get_comment_ID());

Source →

Separate Trackbacks and Comments Solutions

Seperating comments and trackbacks is perhaps the most common hack developers search for. As a result there are various solutions and techniques (and, of course, plugins) you could use, we have a listed some resources below that will help:

You might also like…

Dummy Content Filler Resources for WordPress, Drupal and Joomla Developers →
10 Useful WordPress Search Code Snippets →
30 Grid-Based WordPress Themes →
40 More Stylish, Minimal and Clean Free WordPress Themes →
20+ Free and Stylish Typography WordPress Themes →
30 Brand New Quality WordPress Themes →
10 Blank/Naked WordPress Themes Perfect for Development →
25 Fresh, Clean and Unique WordPress Themes →
40 Awesome and Fresh WordPress Themes →
Essential WordPress Plugin Development Resources, Tutorials and Guides →
20+ Powerful WordPress Security Plugins and Some Tips and Tricks →

About the Author: Paul Andrew (622 Articles)

Paul Andrew is the editor and founder of Speckyboy Design Magazine. You can follow Speckyboy on Twitter, on Facebook, on Digg or you can subscribe via RSS.

19 Comments (Leave yours)

  1. Nikunj says:

    super-awesome list was searching for many of the similar tutorials, thanks Paul you made it available on single post.

  2. Reply
  3. I am using some of these plug-ins and some are very necessary for any blog. good collection.
    :)

  4. Reply
  5. Please note that the Google Analytics video is out of date as Google have changed their placement of the google analytics code to be just before the end of the head section.

    This also means some new code needs to be used not the old one that went before the end body tag

    See the analytics site for more info.

  6. Reply
  7. christian says:

    Yeah, awesome list !!!

    Exactly what I’m looking for !

  8. Reply
  9. Great article! – I’ve just recently begin to use WP, since I’ve been using ASP.net. It’s brilliant with some simple examples using PHP and WP.

    Thanks for sharing!

  10. Reply
  11. Lourens says:

    You’re my hero, I can delete two plug-ins on my own website! =D

  12. Reply
  13. Benet says:

    Great article, should reduce the plugin bloat nicely! Thank you!

  14. Reply
  15. Dutch says:

    This is a freakin’ awesome post for every WordPress geek

  16. Reply
  17. Thanks. There goes my weekend :)

  18. Reply
  19. Nice collection. However, I don’t like the option of making change to the HTACCESS when I can easily do that using wp_head hook.

  • Web Design Weekly Articles Roundup | Blog CodeMyImage
  • 20 things you can code that replaces a plugin | PressingWords
  • wpmag.com - WordPress News, Themes, Tutorials, Plugins, Questions, ...
  • risorse&link | Art&Me
  • [Wordpress] 20 Plugin Replacing Tutorials, Tips, Snippets and Solutions for WordPress – プラグイン代替えとなるチュートリアルやTips - mBlog
  • Great info for making your wordpress site work even better.

    Posted via email from rightinfo's posterous

    Friday, December 17, 2010

    Custom Login/Register/Password Code

    In this DiW post, we transform three slices of code into a clean & stylish tabbed menu that visitors can use to login, register, and recover passwords from anywhere in your site. Too many features & details to explain up front, so check out the working demo to see the finished product. On the menu:

    Default WordPress Login Page

    Out of the box, WordPress uses wp-login.php for logging into the Admin, retrieving lost passwords, and registering for site membership. Each of these activities are handled on the same page, commonly referred to as the WordPress Login Page.

    [ Screenshot: Default WordPress Login/Register Page ]
    Yep, it’s the WordPress Login Page

    As seen here, the Login Page shows the log-in form by default. Beneath the form are two links, “Register” and “Lost your password?”, which enable users to (yep, you guessed it) register and recover their password.

    The cool thing about the Login Page is that the page doesn’t reload when either of these links are clicked. Instead, the form instantly changes from login to register or password to whatever. All three forms are included on the wp-login.php page and hidden/revealed as-needed using JavaScript. This “same-page” functionality is key to setting up our own custom login/register/password form elsewhere in our theme.

    Moving the login/register/password form

    While it’s not a good idea to move the entire wp-login.php file, it is possible to display the login/register/password forms anywhere in your theme. For example, putting the forms in your sidebar.php make it super-easy for visitors to register and login from anywhere in your site (here is an example). You could even create a WordPress page for each event: login, registration, and password-recovery pages that are customized/optimized in some really unique, bad-ass way.

    The key to mobilizing the login forms is ensuring that they’ll work properly regardless of placement (before, after, or within the loop) in your theme template files. We also want to ensure that normal visitors who aren’t logged in see the forms, but logged-in users do not (or see alternate content).

    Basically, it should work exactly like the default WordPress login functionality, but with one exception: instead of redirecting to the Admin Area (for log-ins) or to the Login Page (for registrations/password-recovery), we want the user to remain on the same page. This enables your guests to log-in, register, and reset passwords without leaving whatever page they happen to be visiting. Here’s the code to make it happen..

    Custom WordPress template code

    Here is the code to display the login/register/password form anywhere in your theme:

    view as plain text

    <div id="login-register-password">  <?php global $user_ID, $user_identity; get_currentuserinfo(); if (!$user_ID) { ?>  <ul class="tabs_login"> <li class="active_login">Login</li> <li>Register</li> <li>Forgot?</li> </ul> <div class="tab_container_login"> <div id="tab1_login" class="tab_content_login">  <?php $register = $_GET['register']; $reset = $_GET['reset']; if ($register == true) { ?>  <h3>Success!</h3> <p>Check your email for the password and then return to log in.</p>  <?php } elseif ($reset == true) { ?>  <h3>Success!</h3> <p>Check your email to reset your password.</p>  <?php } else { ?>  <h3>Have an account?</h3> <p>Log in or sign up! It&rsquo;s fast &amp; <em>free!</em></p>  <?php } ?>  <form method="post" action="<?php bloginfo('url') ?>/wp-login.php" class="wp-user-form"> <div class="username"> <label for="user_login"><?php _e('Username'); ?>: </label> <input type="text" name="log" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" tabindex="11" /> </div> <div class="password"> <label for="user_pass"><?php _e('Password'); ?>: </label> <input type="password" name="pwd" value="" size="20" id="user_pass" tabindex="12" /> </div> <div class="login_fields"> <div class="rememberme"> <label for="rememberme"> <input type="checkbox" name="rememberme" value="forever" checked="checked" id="rememberme" tabindex="13" /> Remember me </label> </div> <?php do_action('login_form'); ?> <input type="submit" name="user-submit" value="<?php _e('Login'); ?>" tabindex="14" class="user-submit" /> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" /> <input type="hidden" name="user-cookie" value="1" /> </div> </form> </div> <div id="tab2_login" class="tab_content_login" style="display:none;"> <h3>Register for this site!</h3> <p>Sign up now for the good stuff.</p> <form method="post" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" class="wp-user-form"> <div class="username"> <label for="user_login"><?php _e('Username'); ?>: </label> <input type="text" name="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" tabindex="101" /> </div> <div class="password"> <label for="user_email"><?php _e('Your Email'); ?>: </label> <input type="text" name="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" id="user_email" tabindex="102" /> </div> <div class="login_fields"> <?php do_action('register_form'); ?> <input type="submit" name="user-submit" value="<?php _e('Sign up!'); ?>" class="user-submit" tabindex="103" /> <?php $register = $_GET['register']; if($register == true) { echo '<p>Check your email for the password!</p>'; } ?> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" /> <input type="hidden" name="user-cookie" value="1" /> </div> </form> </div> <div id="tab3_login" class="tab_content_login" style="display:none;"> <h3>Lose something?</h3> <p>Enter your username or email to reset your password.</p> <form method="post" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" class="wp-user-form"> <div class="username"> <label for="user_login" class="hide"><?php _e('Username or Email'); ?>: </label> <input type="text" name="user_login" value="" size="20" id="user_login" tabindex="1001" /> </div> <div class="login_fields"> <?php do_action('login_form', 'resetpass'); ?> <input type="submit" name="user-submit" value="<?php _e('Reset my password'); ?>" class="user-submit" tabindex="1002" /> <?php $reset = $_GET['reset']; if($reset == true) { echo '<p>A message will be sent to your email address.</p>'; } ?> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?reset=true" /> <input type="hidden" name="user-cookie" value="1" /> </div> </form> </div> </div>  <?php } else { // is logged in ?>  <div class="sidebox"> <h3>Welcome, <?php echo $user_identity; ?></h3> <div class="usericon"> <?php global $userdata; get_currentuserinfo(); echo get_avatar($userdata->ID, 60); ?>  </div> <div class="userinfo"> <p>You&rsquo;re logged in as <strong><?php echo $user_identity; ?></strong></p> <p> Log out |  <?php if (current_user_can('manage_options')) {  echo '' . __('Admin') . ''; } else {  echo '' . __('Profile') . ''; } ?>  </p> </div> </div>  <?php } ?>  </div>

    Okay, so here are the functional highlights for this hefty chunk of code:

    • Everything is wrapped with <div id="login-register-password"></div>
    • If the user is not logged in, the three forms are included in the markup
    • If the user is logged in, a simple welcome message is displayed
    • Success messages are displayed after both password recovery and registration
    • Each form submission sets a generic user-cookie
    • After login or registration, the script redirects the user to the same page
    • Only one form is shown at a time; JavaScript is used to show and hide forms

    So if you just throw this thing into your sidebar.php file, you’ll see the login form and three links: login, register, and recover-password. The other two forms are included in the markup, but are hidden with CSS (display:none;). As-is, the three links won’t do anything because they require JavaScript to work. Once we sprinkle in some jQuery, the links will toggle the three different forms.

    Implement and Demo

    First let’s walk through using this code in your theme, and then we’ll check out a demo.

    1. Place the custom login code in your sidebar.php file, or some other location
    2. Grab the jQuery code (no-conflict mode) and include it in your footer.php file
    3. Include the CSS code in your theme’s style.css file, or wherever your styles are located

    ..and done. Once these three items are in place, upload everything to your server and check it out. Here is a demo showing this code used on a custom page within the loop.

    Note that we have registration disabled here at DigWP.com, so the forms won’t be of much use other than to show how the tabs work and how the forms are styled. Here are some screenshots showing the “success” messages, and also the “logged-in” display.

    [ Screenshot: Registration Success Message ]
    Message displayed on successful registration

    [ Screenshot: Password-Recovery Success Message ]
    Message displayed on successful password-recovery

    [ Screenshot: Logged-In View ]
    Content displayed when user is logged into the site

    Here again is the demo and here are the three resource files:

    Customizing things

    One of the main reasons why we like working with actual code instead of widgets or plugins is the ability to easily customize anything we want exactly how we want it. With this implementation, there are basically three things to customize: the jQuery, the custom login code, and the CSS. As with any code, there are countless ways to modify appearance and functionality, so hopefully you have something specific in mind, and are familiar enough with design to jump in and customize things. If not, no worries – here are some ideas to help get you started.

    Customizing the login forms

    As-is, the custom login forms redirect to the current page. To get any/all of the forms to redirect to a different page, locate and edit the following line of code:

    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

    There are three instances of this hidden input field, which WordPress uses to perform the redirect. The value returns the current URL, so that’s what needs changed for each form to redirect elsewhere.

    Another useful modification involves customizing what the logged-in users see. Showing the gravatar and username is kind of neat, but there are tons of cool tricks to help ensure smooth user experience.

    Customizing the jQuery

    The jQuery used to show/hide the different login panels is actually pretty basic and is only used for toggling display states. I suppose there is a way to customize this, but it already handles additional menu items, so maybe you want to change the class names or optimize the script or something.

    I do love to look at a nice slice of well-formatted jQuery, however, so I’ll further indulge myself by including the entire code snippet right here:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".tab_content_login").hide(); $("ul.tabs_login li:first").addClass("active_login").show(); $(".tab_content_login:first").show(); $("ul.tabs_login li").click(function() { $("ul.tabs_login li").removeClass("active_login"); $(this).addClass("active_login"); $(".tab_content_login").hide(); var activeTab = $(this).find("a").attr("href"); if ($.browser.msie) {$(activeTab).show();} else {$(activeTab).show();} return false; }); }); </script>

    A bit heavy-handed perhaps, but works great with no editing required ;)

    Customizing the CSS

    To get that fancy tabbed form menu looking all clean and rounded, much CSS is used. So instead of posting endless gobs of CSS, here is the code in plain text. As with any CSS, the best way to customize things is to open Firebug and start tweaking.

    Just the links

    One last trick: use this code to display links to the default WordPress login/registration page:

    <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <?php wp_meta(); ?> </ul>

    Nothing to golf about, but I figured it was worth mentioning.

    Wrap up

    Using the code and techniques in this article, you can provide your readers with a login form anywhere on your site. This makes it easy for your users and visitors to login/logout, register for your site, and recover passwords without leaving their current page. The login code works great as-is or is easily transformed into a snazzily tabbed login menu using a sprinkle of CSS and a dash of jQuery.

    Finally, one of the great things about WordPress is that there is always more than one way to set things up. So if you see a way to improve the code, please share with the community by leaving a comment. Thank you!

    Possibly Related Posts

    Make it easy for your wp users to login, register and/or grab their lost password. Put the login, register, recover password code anywhere in your theme.

    Posted via email from rightinfo's posterous

    Wednesday, December 1, 2010

    How to Add Google Documents to the Windows Explorer “New” Menu - How-To Geek

    This is really cool if you want to integrate google docs into your windows system more fully. Just follow this tutorial and get the files and icons provided.

    Posted via email from rightinfo's posterous

    How To Create An Interactive Quiz Using Powerpoint Masters

    Create interactive presentations with Powerpoint

    Posted via email from rightinfo's posterous

    How To Create An Interactive Quiz Using Powerpoint Masters

    Create interactive quizzes with Powerpoint.

    Posted via email from rightinfo's posterous

    How To Create An Interactive Quiz Using Powerpoint Masters

    Create interactive quizzes using Powerpoint.

    Posted via email from rightinfo's posterous

    Saturday, November 20, 2010

    Make Forms in Word 2007

    If you have Microsoft Word this is an easy way to create forms that others can fill in, although your recipients will also need to have MS Word.

    Posted via email from rightinfo's posterous

    Sunday, November 14, 2010

    PHP snippets to interact with Twitter

    Get number of Twitter followers

    Have you seen my blog sidebar? I display the number of followers I have in full text. This is actually pretty easy to do. The first thing you need is this function:

    function get_followers($twitter_id){ $xml=file_get_contents('http://twitter.com/users/show.xml?screen_name='.$twitter_id); if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) { $tw['count'] = $match[1]; }  return $tw['count']; }

    Once you have the function, you can call it as shown below:

    $nb =  get_followers('phpsnippets'); echo "PHP Snippets already have ".$nb." followers!";

    » Credit: http://www.phpsnippets.info/get-twitters-followers-in-php

    Get latest Twitter status

    Using PHP and cURL, it is pretty easy to get the status of a specific user. Once you have it, what about displaying it on your blog, like I do in WPRecipes footer?

    function get_status($twitter_id, $hyperlinks = true) { $c = curl_init(); curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $src = curl_exec($c); curl_close($c); preg_match('/<text>(.*)<\/text>/', $src, $m); $status = htmlentities($m[1]); if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '\\0', $status); return($status); }

    The function is extremely easy to use:

    echo get_status('catswhocode');

    » http://www.phpsnippets.info/get-twitter-status-using-php

    Link to update status, without encoding problems

    Many websites and blogs show you how to create a link to Twitter that will update your status. But unfortunely, most websites don’t explain what you need to do in order to avoid encoding problems of spaces and special characters.

    Tweet!

    So, where’s the change? Pretty simple: Just note that I havent linked to http://www.twitter.com, but to http://twitter.com, without the www.

    A working example can be seen on my company website: http://www.webdevcat.com/contact.

    Get number of retweets for a specific page

    Most bloggers are using the Tweetmeme widget to display the number of retweets of their posts. Did you know that Tweetmeme also has an API you can use to get how many times a specific url has been retweeted?

    The following function will get the number of RT’s of the url passed as a parameter:

    function tweetCount($url) { $content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url); $element = new SimpleXmlElement($content); $retweets = $element->story->url_count; if($retweets){ return $retweets; } else { return 0; } }

    Using the function is easy, as you can expect:

    echo tweetCount('http://www.catswhocode.com');

    Note that the Twitter API also provide a way to get the number of retweets. See http://urls.api.twitter.com/1/urls/count.json?url=www.google.com for example.

    » http://www.phpsnippets.info/get-how-many-times-a-page-have-been-retweeted-using-php

    Testing friendship between two users

    If you want to know if a specific user is following you (or someone else) you have to use the Twitter API. This snippet will echo true if the two users specified on lines 18 and 19 are friends. It will return false otherwise.

    /* makes the request */ function make_request($url) { $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $result = curl_exec($ch); curl_close($ch); return $result; }  /* gets the match */ function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; }  /* persons to test */ $person1 = 'phpsnippets'; $person2 = 'catswhocode';  /* send request to twitter */ $url = 'https://api.twitter.com/1/friendships/exist'; $format = 'xml';  /* check */ $persons12 = make_request($url.'.'.$format.'?user_a='.$person1.'&user_b='.$person2); $result = get_match('/<friends>(.*)<\/friends>/isU',$persons12); echo $result; // returns "true" or "false"

    » http://www.phpsnippets.info/get-twitter-status-using-php

    Shorten urls for Twitter

    As you know if you’re a Twitter user, you can’t post messages which are longer than 140 characters. To avoid this problem, you have to use an url shortener. There’s lots of different url shorteners on the internet. TinyUrl.com is one of them, it doesn’t produce the shortest urls but what I really love it is that you don’t need to have an account to use it with PHP.

    The following function takes a long url as a parameter and return a shorter url, using the TinyUrl url shortener.

    function getTinyUrl($url) { return file_get_contents("http://tinyurl.com/api-create.php?url=".$url); }

    » http://www.phpsnippets.info/convert-url-to-tinyurl

    Shorten urls using Bit.ly

    In the previous snippet of that article, I’ve shown you how you can shorten your urls using TinyUrl.com. This is cool, but I’m pretty sure some of you prefer using the bit.ly service. No problem, you can still use PHP to get your shortened url.

    function bitly($url) { $content = file_get_contents("http://api.bit.ly/v3/shorten?login=YOURLOGIN&apiKey=YOURAPIKEY&longUrl=".$url."&format=xml"); $element = new SimpleXmlElement($content); $bitly = $element->data->url; if($bitly){ return $bitly; } else { return '0'; } }

    To use the function, simply use the following:

    echo bitly("http://www.catswhocode.com");

    » http://woorkup.com/2010/06/06/3-practical-wordpress-code-snippets-you-probably-must-know/

    You don't need plugins for everything!

    Posted via email from rightinfo's posterous

    Things You Should Do Immediately After Launching a Website

    Wednesday, November 10, 2010

    How To Easily Turn Your WordPress Blog Into An E-Commerce Site

    A Point of Sale solution using wordpress.

    Posted via email from rightinfo's posterous

    Putting FTP Info in wp-config.php to Ease Updates

    This is something to put in your notebook to make your wordpress updates faster on some servers.

    Posted via email from rightinfo's posterous

    Tuesday, November 2, 2010

    How to Add an Admin to Your Facebook FanPage

    Skip to content

      Categories:

    How to Add an Admin to Your Facebook FanPage

    WP Greet Box icon

    Welcome! If you are new here, you might want to get Free Blog Updates via your Favorite RSS Reader . Not sure what an RSS Reader is? Get Free Updates by Email

    I get asked quite often how to add an admin to a Facebook FanPage, as it is not such an intuitive process, so here is a quick step-by-step guide to doing just that.

    Adding an Admin to Your FanPage on Facebook

    edit facebook page

    1. Log in to your Facebook Account.  On the top right click on “Account.”  Then click on “Manage Pages.”  Once you click on “Manage Pages,” select the page you wish to add an Admin for.
    2. At the top left of your page right under your Fan Page’s logo you will see a link called “Edit Page.”  Click on “Edit Page.” (Figure 1)
    3. Add an Admin to Facebook Fan PageScroll down to the middle of the page.  To the right you will see a small box with your profile picture on it.  You will see the word “Admins” above your picture.  To the right of that header you will see the word “add.”  Click on “Add.”
    4. Once you do that, a window will pop open and ask you to select friends of yours to become admins of your FanPage.  You can start typing in the field next to “find friends” or click on the picture if you see the friend in your window.  You can also add admins via email by entering the admin’s email address in the email field.
    5. You can then add a personal message for your new admin.  Finally, select “Add Admins.”

    Add an Admin to Facebook Fan Page

    All Done!

    If you enjoyed this post feed yourself updates!


    Posted in Facebook Marketing.

    By Dali
    October 19, 2010
    No comments ]-->

    0 Responses

    Stay in touch with the conversation, subscribe to the

    Great info to add an admin to your facebook fanpage!

    Posted via email from rightinfo's posterous

    Tuesday, October 26, 2010

    Print Files From Anywhere via Any Device With Dropbox

    Need to print from another computer but no printer nearby, what about printing from your mobile?

    Check out this article, it provides the solution.

    Posted via email from rightinfo's posterous