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

add option to change "More Fields" metabox title #727

Closed
pdewouters opened this issue Nov 4, 2012 · 7 comments
Closed

add option to change "More Fields" metabox title #727

pdewouters opened this issue Nov 4, 2012 · 7 comments
Assignees
Labels
Type: Enhancement Enhancements to features that already exist, but are not major additions
Milestone

Comments

@pdewouters
Copy link

How can I change the "More Fields" text?

@sc0ttkclark
Copy link
Member

Use the new 'pods_meta_default_box_title' filter

@srikat
Copy link

srikat commented Mar 8, 2013

Ok.

So

add_filter('pods_meta_default_box_title','changethatname');

function changethatname($value) {
$value = 'Dancer Details';
return $value;
}

for example, works.

How can we modify the above to specify different default box titles for different Pods?

@greenweb
Copy link

srikat - you probably worked this out already but I hope someone else finds this useful:

add_filter('pods_meta_default_box_title','changethatname',10,5);
/* See http://codex.wordpress.org/Function_Reference/add_filter */

function changethatname($title, $pod, $fields, $type, $name ) {

  // assuming we are changing the meta box title on a pod named 'page' 
  $title = ($name=='page') ? __('My Meta box title', 'plugin_lang') : $title ;

  return $title;
}

@jaycollier
Copy link

What would be the code to change the meta titles for multiple post types?

@sc0ttkclark
Copy link
Member

sc0ttkclark commented Apr 16, 2019

@jaycollier

add_filter( 'pods_meta_default_box_title', 'my_change_pods_metabox_title', 10, 5 );

/**
 * Filter the title of the Pods metabox for multiple post types.
 *
 * @param string   $title  The title to use, default is 'More Fields'.
 * @param obj|Pods $pod    Current Pods Object.
 * @param array    $fields List of fields that will go in the metabox.
 * @param string   $type   The type of Pod.
 * @param string   $name   Name of the Pod.
 *
 * @return string The title for the metabox.
 *
 * @since unknown
 */
function my_change_pods_metabox_title( $title, $pod, $fields, $type, $name ) {
	$post_types_to_change = [
		'my_custom_post_type',
		'post',
		'page',
	];

	if ( ! in_array( $name, $post_types_to_change, true ) ) {
		return $title;
	}

	return 'My custom title';
}

cc @jimtrue

@jaycollier
Copy link

Thank you! I was imagining different titles for different post types, but this will be good!

@jimtrue
Copy link
Contributor

jimtrue commented Apr 17, 2019

Updated: https://docs.pods.io/code-snippets/change-more-fields-meta-box-title/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Enhancements to features that already exist, but are not major additions
Projects
None yet
Development

No branches or pull requests

6 participants