/**
  * @group get_term_meta
  */
 public function test_get_term_meta_all()
 {
     $Meta = new Smart_Custom_Fields_Meta(get_term($this->term_id, 'category'));
     $Meta->update('text', 'hoge');
     $Meta->add('checkbox', 1);
     $Meta->add('checkbox', 2);
     // ループ内のチェックボックス(複数値項目)は必ずこのメタデータを持つ
     $Meta->add(SCF_Config::PREFIX . 'repeat-multiple-data', array('checkbox3' => array(1, 2)));
     $Meta->add('checkbox3', 1);
     $Meta->add('checkbox3', 2);
     $Meta->add('checkbox3', 3);
     $this->assertEquals(array('text' => 'hoge', 'checkbox' => array(1, 2), 'group-name-3' => array(array('text3' => '', 'checkbox3' => array(1)), array('text3' => '', 'checkbox3' => array(2, 3))), 'text-has-default' => '', 'text-has-not-default' => '', 'checkbox-has-default' => array(), 'checkbox-has-not-default' => array()), SCF::get_term_meta($this->term_id, 'category'));
 }
示例#2
0
//取得したいタグ情報
$tags = get_the_tags();
//取得したいタームのID
$term_id = $tags[0]->term_id;
//取得したいタクソノミーの種類 category | post_tag | カスタムタクソノミー
$taxonomy = 'post_tag';
//取得したいカスタムフィールド
$key_image = SCF::get_term_meta($term_id, $taxonomy, 'cf-artistKeyImage');
$artist_image = SCF::get_term_meta($term_id, $taxonomy, 'cf-artistImage');
$artist_string = SCF::get_term_meta($term_id, $taxonomy, 'cf-artistString');
$instagram_url = SCF::get_term_meta($term_id, $taxonomy, 'cf-instagramUrl');
$facebook_url = SCF::get_term_meta($term_id, $taxonomy, 'cf-facebookUrl');
$twitter_url = SCF::get_term_meta($term_id, $taxonomy, 'cf-twitterUrl');
$pinterest_url = SCF::get_term_meta($term_id, $taxonomy, 'cf-pinterestUrl');
$tumblr_url = SCF::get_term_meta($term_id, $taxonomy, 'cf-tumblrUrl');
$vimeo_url = SCF::get_term_meta($term_id, $taxonomy, 'cf-vimeoUrl');
get_header();
?>
    <!-- Header -->
    <header>
    <div class="u-text-center logo">
        <a href="<?php 
home_url();
?>
"><img src="<?php 
bloginfo('template_directory');
?>
/img/logo.png" alt="vital logo"></a>
    </div>
    <nav>
        <div class="nav-wrapper">
 /**
  * @group save
  */
 public function test_save_タームの場合_SCFの定義されたデータが送信されていないときは保存しない()
 {
     $POST = $this->_return_post_data_for_save('dummy');
     $this->Meta_term->save($POST);
     $this->assertSame(array(), SCF::get_term_meta($this->term_id, 'category', 'checkbox'));
 }
 /**
  * @group get_term_meta
  */
 public function test_get_term_meta()
 {
     $this->assertNull(SCF::get_term_meta($this->term_id, 'category', 'text'));
 }