Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

„Rename every type“ tests & awesome sample #887

Open
1 task done
carstingaxion opened this issue Sep 19, 2024 · 0 comments
Open
1 task done

„Rename every type“ tests & awesome sample #887

carstingaxion opened this issue Sep 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@carstingaxion
Copy link
Collaborator

carstingaxion commented Sep 19, 2024

Is your enhancement related to a problem? Please describe.

Is GatherPress consistent in its type naming? I’m not sure.

Within a separate plugin, modify the labels (all labels !) for all the registered main data types, using post_type_labels_{$post_type}

  • Events —> gigs
  • Venues —> spots
  • Topics —> types
  1. Test that all administrative texts follow the new labels.
  2. This means to find EVERY instance of the string: „event“, „venue“ and „topic“ ( and their plurals); and replace them the dynamic values from post_type->labels
  3. Create a GatherPress-awesome example from all of that

Designs

The developer docs have this simple example:

If you need to modify the post type labels, note the labels parameter for this filter is an object, not an array.

In the example below, the post type is “employee” and the new label reference is “headshot”.

/**
 * Changes strings referencing Featured Images for a post type
 * 
 * @param 		object 		$labels 		Current post type labels
 * @return 		object 					Modified post type labels
 */
function change_featured_image_labels( $labels ) {

	$labels->featured_image 	= 'Headshot';
	$labels->set_featured_image 	= 'Set headshot';
	$labels->remove_featured_image 	= 'Remove headshot';
	$labels->use_featured_image 	= 'Use as headshot';

	return $labels;

} // change_featured_image_labels()

add_filter( 'post_type_labels_employee', 'change_featured_image_labels', 10, 1 );

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@carstingaxion carstingaxion added the enhancement New feature or request label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant