Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Was just about to post this too – troublemaker is WPSEO_Pointers::print_scripts, lines 233 & 239, which applies esc_js() to the button function parameters.

    Escaping should be performed (where necessary) as the caller builds the JS code, and then printed as-is by print_scripts().

    Forum: Plugins
    In reply to: How do I enter line breaks?

    Why not set a bottom margin on lists and images?

    .entry ul, .entry img {
        margin-bottom: 2em;
    }

    Firstly, I would recommend making these modifications in a plugin, or more easily, in your theme’s functions.php.

    From the link you provided, I’ve taken a guess at what you are after. Copy the below into your theme’s functions.php and see how it goes!

    Note: I have removed the <style>..</style> tags from the gallery output. You should put the CSS you require in your theme’s style.css.

    function tt_gallery_shortcode($attr)
    {
    	global $post;
    
    	static $instance = 0;
    	$instance++;
    
    	// Allow plugins/themes to override the default gallery template.
    	$output = apply_filters('post_gallery', '', $attr);
    	if ( $output != '' )
    		return $output;
    
    	// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    	if ( isset( $attr['orderby'] ) ) {
    		$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
    		if ( !$attr['orderby'] )
    			unset( $attr['orderby'] );
    	}
    
    	extract(shortcode_atts(array(
    		'order'      => 'ASC',
    		'orderby'    => 'menu_order ID',
    		'id'         => $post->ID,
    		'itemtag'    => 'div',
    		'icontag'    => 'span',
    		'captiontag' => 'span',
    		'columns'    => 3,
    		'size'       => 'thumbnail'
    	), $attr));
    
    	$id = intval($id);
    	$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
    
    	if ( empty($attachments) )
    		return '';
    
    	if ( is_feed() ) {
    		$output = "\n";
    		foreach ( $attachments as $att_id => $attachment )
    			$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
    		return $output;
    	}
    
    	$itemtag = tag_escape($itemtag);
    	$captiontag = tag_escape($captiontag);
    	$columns = intval($columns);
    	$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
    
    	$selector = "gallery-{$instance}";
    
    	$output = apply_filters('gallery_style', "
    		<div id='$selector' class='gallery galleryid-{$id}'>");
    
    	$i = 0;
    	foreach ( $attachments as $id => $attachment ) {
    
    		$link = wp_get_attachment_link($id, $size, true, false);
    
    		$link_caption = "<{$captiontag} class='desc'>" . wptexturize($attachment->post_excerpt) . "</{$captiontag}>";
    
    		// splice the caption inside the anchor tag
    		$link = preg_replace('|</a>|', $link_caption . '</a>', $link);
    
    		$output .= "<{$itemtag} class='gallery-item imgteaser'>
    		";
    		$output .= $link;
    		$output .= "</{$itemtag}>
    		";
    
    		if ( $columns > 0 && ++$i % $columns == 0 )
    			$output .= '<br style="clear: both" />';
    	}
    
    	$output .= "
    			<br style='clear: both;' />
    		</div>\n";
    
    	return $output;
    }
    
    add_shortcode('gallery', 'tt_gallery_shortcode');

    Forum: Plugins
    In reply to: updatable plugin

    If you use the WordPress plugin directory, you can manage updates and version changes using SVN. Anyone running your plugin will be notified of version changes and given the option to upgrade (automatically), all handled by WordPress!

    http://wordpress.org/extend/plugins/about/

    What version of WordPress were you running at the time?

    Forum: Developing with WordPress
    In reply to: DOCTYPE

    You could filter the content server-side just before it’s added to the database, replacing ‘/>’ for ‘>’?

    It’s thanks to the function get_editable_roles (currently on line 284 in wp-admin/includes/user.php).

    Since the introduction of this function in 2.8, when a user is added or updated, the role to be assigned is cross-referenced with the return of get_editable_roles.

    If the new role is not one of the ‘editable roles’, you get the error roganty was having.

    The fix is to filter the editable roles, and add an empty key to the roles array.

    add_filter('editable_roles', 'fix_no_role_for_this_blog');
    
    function fix_no_role_for_this_blog($roles)
    {
        $roles[''] = true;
        return $roles;
    }
Viewing 8 replies - 1 through 8 (of 8 total)