Pods: "더 λ§Žμ€ ν•„λ“œ" λ©”νƒ€λ°•μŠ€ 제λͺ©μ„ λ³€κ²½ν•˜λŠ” μ˜΅μ…˜ μΆ”κ°€

에 λ§Œλ“  2012λ…„ 11μ›” 04일  Β·  7μ½”λ©˜νŠΈ  Β·  좜처: pods-framework/pods

"더 λ§Žμ€ ν•„λ“œ" ν…μŠ€νŠΈλ₯Ό μ–΄λ–»κ²Œ λ³€κ²½ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

Enhancement

λͺ¨λ“  7 λŒ“κΈ€

μƒˆλ‘œμš΄ 'pods_meta_default_box_title' ν•„ν„° μ‚¬μš©

확인.

κ·Έλž˜μ„œ

add_filter('pods_meta_default_box_title','changethatname');

ν•¨μˆ˜ 변경이름($κ°’) {
$value = 'λŒ„μ„œ 정보';
λ°˜ν™˜ $ κ°’;
}

예λ₯Ό λ“€μ–΄, μž‘λ™ν•©λ‹ˆλ‹€.

λ‹€λ₯Έ Pod에 λŒ€ν•΄ λ‹€λ₯Έ κΈ°λ³Έ μƒμž 제λͺ©μ„ μ§€μ •ν•˜κΈ° μœ„ν•΄ μœ„μ˜ λ‚΄μš©μ„ μ–΄λ–»κ²Œ μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

srikat - 당신은 이미 이것을 ν•΄κ²°ν–ˆμ§€λ§Œ λ‹€λ₯Έ λˆ„κ΅°κ°€κ°€ 이것을 μœ μš©ν•˜κ²Œ μ‚¬μš©ν•˜κΈ°λ₯Ό λ°”λžλ‹ˆλ‹€.

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

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.
 *
 * <strong i="7">@param</strong> string   $title  The title to use, default is 'More Fields'.
 * <strong i="8">@param</strong> obj|Pods $pod    Current Pods Object.
 * <strong i="9">@param</strong> array    $fields List of fields that will go in the metabox.
 * <strong i="10">@param</strong> string   $type   The type of Pod.
 * <strong i="11">@param</strong> string   $name   Name of the Pod.
 *
 * <strong i="12">@return</strong> string The title for the metabox.
 *
 * <strong i="13">@since</strong> 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

κ°μ‚¬ν•©λ‹ˆλ‹€! λ‹€λ₯Έ κ²Œμ‹œλ¬Ό μœ ν˜•μ— λŒ€ν•΄ λ‹€λ₯Έ 제λͺ©μ„ μƒμƒν–ˆμ§€λ§Œ 이것은 쒋을 κ²ƒμž…λ‹ˆλ‹€!

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰