Feb 26, 2012 - jQuery    Comments Off on Inline Form Labels

Inline Form Labels

jQuery(document).ready(function($) {
	// inline labels for form text fields.
	$('form input[type="text"], form textarea').val(function(index,value){
		$(this).siblings('label').css('display','none');
		return $(this).siblings('label').html();
	});
	$('form input[type="text"], form textarea').focus(function(){
		$(this).val('');
	});
	$('form input[type="text"], form textarea').blur(function(){
		if($(this).val() == ''){
			$(this).val(function(index,value){
				return $(this).siblings('label').html();
			});
		}
	});
});
Feb 9, 2012 - Drupal 7    Comments Off on Bulk hide comments

Bulk hide comments

UPDATE drpl_node SET comment = 0 WHERE type = 'article';
UPDATE drpl_node_revision SET comment = 0 WHERE nid IN (SELECT nid FROM drpl_node WHERE type = 'article');
Feb 3, 2012 - WordPress    Comments Off on Those wacky theme paths

Those wacky theme paths

  • get_template_directory(): Returns the absolute template directory path. (PARENT)
  • get_template_directory_uri(): Returns the template directory URI.
  • get_stylesheet_directory(): Returns the absolute stylesheet directory path. (CHILD)
  • get_stylesheet_directory_uri(): Returns the stylesheet directory URI.

See also: How To Load Files Within WordPress Themes

Jan 30, 2012 - WordPress    Comments Off on get_posts caution!

get_posts caution!

Note: get_posts uses 'suppress_filters' => true as default, while query_posts() applies filters by default, this can be confusing when using query-modifying plugins, like WPML.

Jan 20, 2012 - MAMP, Notes    Comments Off on Large mySQL files in MAMP

Large mySQL files in MAMP

Import:

/applications/MAMP/library/bin/mysql -u [USERNAME] -p [DATABASE_NAME] < [PATH_TO_SQL_FILE]

Export:

/applications/MAMP/library/bin/mysqldump -u [USERNAME] -p [DATA_BASENAME] > [PATH_TO_FILE]
Jan 20, 2012 - Drupal 7    Comments Off on Front page template

Front page template

On Drupal 7, use page–front.tpl.php. Note the double dash.

Jan 20, 2012 - Drupal 7    Comments Off on Block embedding in a theme

Block embedding in a theme

Drupal 7:

<?php
$block = module_invoke('ddblock', 'block_view', '1');
print $block['content'];
?>
Jan 18, 2012 - Yahoo! Small Business    Comments Off on .htaccess on Y!

.htaccess on Y!

.htaccess (Hypertext Access)
The name .htaccess refers to the main configuration file for Apache, a popular open-source HTTP server. The .htaccess file can be used to create custom error pages and web page redirects, set up password protection, enable SSI, and more. Yahoo! does not currently allow you to upload .htaccess files to your account. For other customization options, we recommend the Custom Error Pages and password-protection features available in your Web Hosting Control Panel.

What is the point, Yahoo, of telling us all the great things you can do with .htaccess and then tell us it can’t be done on your crappy hosting?