benhuson / wp-subtitle

Development of the WordPress WP Subtitle plugin. http://wordpress.org/plugins/wp-subtitle/
34 stars 16 forks source link

Add a setting to configure the position of sub title input field. #32

Closed mjaschen closed 5 years ago

mjaschen commented 7 years ago

We're using WP Subtitle on our site but we're rendering the sub title string before the main title. To minimize confusion we want to have the input fields in the same order as displayed later. This pull request introduces a config option which enables it to move the sub title field above the main title field.

The setting can be found in WordPress' "Writing" settings page.

The German translation was updated with the newly introduced strings.

mjaschen commented 6 years ago

Hi @benhuson,

it's some days since I opened this pull request. Did you've find some time to review and give me feedback if it'll be merged or not?

Best regards

benhuson commented 6 years ago

Sorry, I haven't. Let me take a quick look now...

benhuson commented 6 years ago

All looks good, just a couple of comments I've added above.

If we can make those adjustments I'll be happy to merge for the next release.

Thank you for contributing 😄

benhuson commented 6 years ago

Cool, thanks.

I'll make sure these changes are merged into the next release.

benhuson commented 6 years ago

@mjaschen While implementing and testing this, it occurred to me that the subtitle can be activated on multiple post types and users may only want the subtitle to appear above the title on some post types.

Rather than providing an admin UI to cater for this, I've tried a version where the the subtitle can be moved for a specific post type via a filter: https://github.com/benhuson/wp-subtitle/tree/feature/field-position

Please download and try the version above, and implement the following filter to move the field. Valid return values are:

function my_wps_subtitle_field_position( $position, $post_type ) {
   if ( 'my_post_type' == $post_type ) {
      return 'before_title';
   }
   return $position;
}
add_filter( 'wps_subtitle_field_position', 'my_wps_subtitle_field_position', 10, 2 );
mjaschen commented 6 years ago

Ok, works for me! Thanks.

benhuson commented 6 years ago

Great. I'll go with that filter in the next release.

benhuson commented 5 years ago

Fixed in https://github.com/benhuson/wp-subtitle/commit/c8bfe482ac8ef5b5828acf4b5b45933057bcc5d9