Changes to Baskerville

Today's update to my WordPress theme Baskerville will introduce some breaking changes.

Many of my themes are getting up there in age, with the oldest one – Lingonberry – celebrating its seventh birthday in 2020. I’ve learned a lot in that time, and with that learning comes the realization that I made a lot of embarassing mistakes in my early themes. (I’m sure I make some in my new ones as well, but hopefully not as many.)

In order to have those themes remain in the directory, I sometimes need to go back and update them to make sure they follow the directory guidelines. That occasionally means that features need to be removed. Today, it’s Baskervilles turn to get some pruning.

Since the start, Baskerville has included these user profile settings:

  • Author Twitter URL
  • Whether to show the author email address in posts and on the contributors page templates

Themes on the theme directory are not allowed to include custom profile settings. That was the case when Baskerville was submitted six years ago, and it’s still the case today. You’ll hear no excuses from me on that front. Baskerville also includes a custom Customizer option for uploading a logo for the site. There wasn’t a logo option in WordPress core when Baskerville was created (in 2014), but one was introduced in WordPress 4.5 (in 2016).

In Baskerville version 2.1.0, which will be submitted today, the custom profile settings will be removed and the logo output will be updated to use the logo setting included in core. If you had a Twitter URL on your profile page previously, it will no longer be output in the post meta section of posts created by your user. The same goes for the author email.

As for the logo option, if you’re already using a logo, that logo will still be displayed in the header and you’ll still be able to remove it in the Administration Panel → Customizer → Logo panel. If you don’t have a logo set since previous, or if you remove your current logo after installing the update, the old Logo panel will disappear. In it’s place, the update introduces support for the core logo option, which you can find in the Site Identity panel in the Customizer. I recommend that you switch to that setting when you’ve installed the update.

Can I get the old profile settings back?

You can add the “Show Email” and “Twitter URL” profile fields back to your site by adding the following code to a Baskerville child theme:

/* ---------------------------------------------------------------------------------------------
   --------------------------------------------------------------------------------------------- */

function baskerville_child_modify_contact_methods( $profile_fields ) {
	$profile_fields['twitter'] = __( 'Twitter-username (without the @)', 'baskerville-child' );
	return $profile_fields;
add_filter( 'user_contactmethods', 'baskerville_child_modify_contact_methods' );

/* ---------------------------------------------------------------------------------------------
   --------------------------------------------------------------------------------------------- */


function baskerville_child_show_extra_profile_fields( $user ) { ?>

	<h3><?php _e( 'Extra profile information', 'baskerville-child' ); ?></h3>

	<table class="form-table">

			<th><label for="showemail"><?php _e( 'Show email', 'baskerville-child' ); ?></label></th>

				<input type="checkbox" name="showemail" id="showemail" value="yes"<?php if ( esc_attr( get_the_author_meta( "showemail", $user->ID )) == "yes") echo " checked"; ?> />	
				<span class="description"><?php _e( 'Check if you want to display your email address in single posts and the contributors page template.', 'baskerville-child' ); ?></span>

add_action( 'show_user_profile', 'baskerville_child_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'baskerville_child_show_extra_profile_fields' );


function baskerville_child_save_extra_profile_fields( $user_id ) {
	if ( ! current_user_can( 'edit_user', $user_id ) ) return false;
	update_user_meta( $user_id, 'showemail', $_POST['showemail'] );
add_action( 'personal_options_update', 'baskerville_child_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'baskerville_child_save_extra_profile_fields' );

Note that you will also need to add output of the author email and Twitter URL to the single.php and template-contributors.php files in your child theme. The easiest way to do that is to copy the single.php and template-contributors.php files from version 2.0.2 of Baskerville, and add them to your child theme.

It’s never fun to remove features in updates, and I apologize for any issues caused by this update. I could choose between this or never updating Baskerville again, so it was a fairly easy decision, all things considered.

If you have any questions about this update, create a new thread on the Baskerville support forum and I’ll get back to you as soon as possible.