Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Helper Functions

mboynes edited this page Feb 11, 2013 · 4 revisions

Helper Functions

connect_types_and_taxes( $types, $taxes )

Parameters

array|object $types
Either a `Super_Custom_Post_Type` object, or an array of them
array|object $taxes
Either a `Super_Custom_Taxonomy` object, or an array of them

Returns

void

get_scpt_formatted_meta( $key, $post_id )

Parameters

string $key
The meta key
int $post_id
(Optional) Post ID

Returns

mixed Depending on field type, will return either a string, a boolean value, a time() value, or an array (of values or objects). Here's a rough breakdown:

  • fields connected with data get an array of $post objects of the selected post(s)
  • wysiwyg return the value run through wpautop()
  • boolean returns a boolean true or false (not the strings '1' or '0' as stored in the DB)
  • checkbox, radio, select[multiple="multiple"] return an array of values
  • date, datetime fields return time() values
  • everything else returns a string of the first meta entry in the database matching that key

the_scpt_formatted_meta( $key )

Parameters

string $key
The meta key

Returns

the_scpt_formatted_meta echos the results of get_scpt_formatted_meta. Must be used inside of the loop.

get_scpt_meta_fields( $post_type )

Parameters

string $post_type _(Optional)_
The post type whose meta fields we want. If absent, the current post's post type is used.

Returns

array An array of the meta fields registered for this post type (using this plugin). The array is associative, with the key being the postmeta name and the value being the field type.