Browsing "WordPress"
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 5, 2012 - WordPress    Comments Off on Conditional CSS for IE

Conditional CSS for IE

wp_enqueue_style(
   'ie7-style',
   get_template_directory_uri() . '/ie7.css'
);
global $wp_styles;
$wp_styles->add_data( 'ie7-style', 'conditional', 'lte IE 7' );
Dec 26, 2011 - WordPress    Comments Off on Default to no link on images

Default to no link on images

This goes into the functions.php file or similar:

//remove auto-links on media
update_option('image_default_link_type','none');
Dec 26, 2011 - Genesis    Comments Off on Genesis Post Image

Genesis Post Image

Default only works on certain pages/posts:

add_action('genesis_post_content', 'genesis_do_post_image');
/**
* Post Image
*/
function genesis_do_post_image() {
if ( !is_singular() && genesis_get_option('content_archive_thumbnail') ) {
$img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array( 'class' => 'alignleft post-image' ) ) );
printf( '%s', get_permalink(), the_title_attribute('echo=0'), $img );
}

}

Here’s a sample fix:

remove_action( 'genesis_post_content','genesis_do_post_image');
add_action( 'genesis_before_post_content','tapestry_do_post_image');</code>

function tapestry_do_post_image() {
$img = genesis_get_image( array( 'format' =&gt; 'html', 'size' =&gt; genesis_get_option('image_size'), 'attr' =&gt; array( 'class' =&gt; 'aligncenter post-image' ) ) );
printf( '<a title="%s" href="%s">%s</a>
<div class="clear"></div>
', get_permalink(), the_title_attribute('echo=0'), $img );
}
Pages:«12345