Twenty Eleven – Overwrite the Dark Color Scheme in a Child Theme

Overwriting or customizing the dark color schem in a child theme of Twenty ten is difficult, because the dark stylesheet /colors/dark.css get loaded after the style.css of the child theme.
You can duplicate the same stylesheet structure in the child theme, but you need to programm the child theme to link the /colors/dark.css file after the corresponding file of the parent theme.

The stylesheet dark.css of the parent theme gets enqueued in twentyeleven/inc/theme-options.php (line 319):

/**
 * Enqueue the styles for the current color scheme.
 *
 * @since Twenty Eleven 1.0
 */
...etc...

Therefore, the dark.css of the child theme needs to be enqueued with a different priority; which can be done by adding a corresponding, adapted code into functions.php of your child theme. This code checks if the ‘dark’ color scheme is selected, and only then enqueues the /colors/dark.css of the child theme, thus allowing full color control from the theme options in the dashboard:

/** Enqueue the stylesheet for the current color scheme into the child theme. */
function twentyelevenchild_enqueue_color_scheme() {
	$options = twentyeleven_get_theme_options();
	$color_scheme = $options['color_scheme'];
	if ( 'dark' == $color_scheme )
		wp_enqueue_style( 'dark_child', get_stylesheet_directory_uri() . '/colors/dark.css', array(), null );
	do_action( 'twentyelevenchild_enqueue_color_scheme', 'dark_child' );
}
add_action( 'wp_enqueue_scripts', 'twentyelevenchild_enqueue_color_scheme', 11);

Now you can edit dark.css in your child theme, and add all the customisations to it.

Custom ‘Read More’ text per Post for Twenty Ten

A sophisticated way to get a custom written ‘read more’ text added to your posts in the theme Twenty Ten (or its child themes).

The code builds on this article I posted earlier.

It uses the custom field with the key ‘cont_read’ to hold the custom text.

Add this code to functions.php of the theme:

/* Twenty Ten custom 'continue reading'
/
/ custom field ($key = 'cont_read' ) dependant 'continue reading' text
/ alchymyth 2010
*/
class Transformation_Text_Wrangler {
function reading_more($translation, $text, $domain) {

global $post;
 $cont_read = get_post_meta( $post->ID, 'cont_read', true );
 if( $cont_read ) :
 $cont_read = htmlentities($cont_read, ENT_QUOTES);
 $translations = &get_translations_for_domain( $domain );
 if ( $text == 'Continue reading <span>&rarr;</span>' ) {
 return $translations->translate( $cont_read . ' <span>&raquo;</span>' );
 }
 return $translation; // custom field value
 else :
 return $translation; // standard text
 endif;
 }
}
add_filter('gettext', array('Transformation_Text_Wrangler', 'reading_more'), 10, 4);

Changing the ‘Read more’ in Twenty Ten Child Theme

To change the ‘read more’ text in a child theme of Twenty Ten, one needs to add a few lines to functions.php of the child theme.

This procedure uses a method that I came across in an introductory article about programming a child theme of Twenty Ten, by Aaron Jorbin, who himself was building upon Mangling strings for fun and profit, by WordPress lead Developer Peter Westwood.

class Transformation_Text_Wrangler {
function reading_more($translation, $text, $domain) {
$translations = &get_translations_for_domain( $domain );
if ( $text == 'Continue reading <span class="meta-nav">&rarr;</span>' ) {
return $translations->translate( 'Get to know more <span class="meta-nav">&raquo;</span>' );
}
return $translation;
}
}
add_filter('gettext', array('Transformation_Text_Wrangler', 'reading_more'), 10, 4);

This way of customising texts in a child theme is applicable to all the strings of the mother theme.