Alphanumeric usernames and error message for it

Check for alphanumeric For more details, look at the regex Q on SO. $name=”input string 123″; // Doesn”t allow: // Pre-/Appending white space // Not more than one space in between // Non-alphanumeric characters (lower case) if( ! preg_match( “/^[a-z0-9]+([\\s]{1}[a-z0-9]|[a-z0-9])+$/i”, $name ) ) { // Output Error Message } // Or: Does only allow // … Read more

How to install Lavalamp jQuery effect in wordpress [duplicate]

<script language=”javascript” type=”text/javascript” src=”https://wordpress.stackexchange.com/questions/30944/wp-content/themes/metric /scripts/jquery-1.4.1.min.js”></script> <link rel=”stylesheet” href=”wp-content/themes/metric/lavalamp.css” type=”text/css” media=”screen” /> <script type=”text/javascript” src=”wp-content/themes/metric/scripts/jquery.easing.min.js”></script> <script type=”text/javascript” src=”wp-content/themes/metric/scripts/jquery.lavalamp.min.js”></script> <script type=”text/javascript”> jQuery(function() { jQuery(‘#nav’).lavaLamp({ fx: ‘backout’, speed: 700, click: function(event, menuItem) { return true; } }); }); </script>

How to list Tags using get_tags in an html table?

This is what I tried and it works well. I am using array_chunk, but I’m also adding a check to see if a chunk has less than 4 values (as you want 4 columns), then just add a blank <td>, which will avoid the mark up from breaking. <?php $tags = get_tags(array(‘hide_empty’ => false)); $tag_groups … Read more

Showing author box on post detail page

Where is your code for the author appearing (what files > category / post / single?)? I would guess you have the author code within either a category or post template file, simply add the author code to the single template file (create single.php if you don’t have one) and remove from the upper level … Read more

Shortcode Variations?

function btn($atts, $content = null) { extract(shortcode_atts(array(‘link’ => ‘#’, ‘color’ => ‘teal’ , ‘size’ => ‘large’), $atts)); return ‘<a class=”btn ‘.$size.'” href=”‘.$link.'” style=”background:’.$color.’;”><span>’ . do_shortcode($content) . ‘</span></a>’; } With that function you get by default color teal and size large. I suppose that for size you are using classess and for color just background. If … Read more

How can I make different page templates for one category?

Make 1 template, and do a conditional on the meta info to either include a different stylesheet, or a entire different file altogether. $colour = get_post_meta(the_ID(), ‘color’); switch($color) { case ‘red’: include(‘category-car-red.php’); // or just different CSS break; case ‘green’: include(‘category-car-green.php’); // or just different CSS break; // etc }