function test_get_relation()
 {
     CCTM::$post_id = 77;
     $rel = get_relation('poster_image');
     $this->assertTrue($rel['ID'] == 120);
 }
Example #2
0
 /**
  * Handles printing of custom fields in the main content blocks.
  *
  * @param	array	$raw_args: parameters from the shortcode: name, filter
  * @param	string	$options (optional)
  * @return string (printed)
  */
 public static function custom_field($raw_args = array(), $options = null)
 {
     $defaults = array('name' => '', 'filter' => '', 'post_id' => '');
     $args = shortcode_atts($defaults, $raw_args);
     if (empty($args['name'])) {
         print __('custom_field shortcode requires the "name" parameter.', CCTM_TXTDOMAIN);
     }
     // Append the ':filter' to the name
     if (!empty($args['filter'])) {
         $args['name'] = $args['name'] . ':' . $args['filter'];
     }
     // See http://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=120
     // This allows users to specify which post they want to retrieve the data from.
     if (!empty($args['post_id'])) {
         CCTM::$post_id = $args['post_id'];
     }
     if (!empty($options)) {
         print_custom_field($args['name'], htmlspecialchars_decode($options));
     } else {
         print_custom_field($args['name']);
     }
 }