CSS can often be tricky.  What do we need to do to get all those pesky browsers to show things the way we want?!  Sometimes, I marvel at the patience of people who find out, after hours, just how to nudge something properly one way or get the body of text to flow and display just the way they’re asked to do it.  So, something so basic, why is it sometimes so much trouble?  And do we need to write all this just to center a block?!  Why can’t we just say “align:center”?!  Don’t get me started on VERTICAL alignment, that’s not nearly as easy as table cells made such a trick out to be….

Add this to any of your CSS or inline where needed and make sure no other margins are defined:


margin-left:auto;margin-right:auto;

Note:  Be sure a width and height of this block element is also defined!


How often do you find yourself making a change to a post or a page, clicking “Update” then the “View Page” link?  Why not just have another button by “Publish” and “Update” that says ” and View” so you can do it all at once?  Just a suggestion, maybe I’ll get around to writing a plug-in just in time for someone else to have written a better one or they include it in the core…. 🙂


This is one of my all-time useful and favorite WordPress shortcodes ever.  It’s so simple, just put the code below into your active theme’s function.php file and now you have a very flexible and powerful shortcode where you can embed external PHP — provided the PHP code is in a file on your own site, of course!

function insert_script($atts){

extract(shortcode_atts(array("path" => '',"vals"=>''), $atts));
	ob_start();
		include($_SERVER['DOCUMENT_ROOT'].$path);
	return ob_get_clean();
}

add_shortcode('insert_script', 'insert_script');

Here’s an example of its use.  If you aren’t familiar with PHP’s parsestr() function, please click here.  It’s a handy way to take any regular query string of variables you’d find in a URL, like ?s=1&action=go and “parse” them out into variable/value matches like:  $s=1, $action=”go”, and so on….

This way, you pass useful variables in a verbose way  in your code — it’s pretty transparent so if the code you’re including isn’t cryptic and is easy to follow, then so will the use of this shortcode in your WordPress pages and posts!

Just put this shortcode in any of your pages or posts, or widgets if you’ve managed to turn on shortcodes in your widgets.  If not, click here to see how easy that is.

[insert_script path='/includes/db/database-connection.php' vars="cmd=show_table"]
//Will find the script at the web root includes folder, parse the variables in the query string "vars" with the PHP command "parsestr()" and execute the PHP


It comes in handy — to be able to use those dynamic and very useful shortcodes in more places.  I’m sure the developers of WordPress have a reason to make developers have to put this extra line in the active theme’s function.php file, so here it is.  Yes, it’s that simple!


add_filter('widget_text', 'do_shortcode');


<?php define('WP_DEBUG', true); ?>

When you’re in development mode, it’s useful to get errors in scripts as they occur.  Just place this line anywhere in your functions.php file for your active child theme and you will start seeing debug feedback complete with script names and line numbers.  You can just remove this line, or set “WP_DEBUG” to false if you want to shut off debugging or definitely before you go live!