Other Projects

Labs


Products

Theming

If you are unfamilar with modifying WordPress themes, you can learn more here.

Custom post type template

By default the template used for a post of a custom post type is the single.php template. You can create a custom template for a posts of a custom post type by copying the single.php template in your theme and renaming it single-.php. For example, if your Movies custom post type's key is "movies", then name your single.php copy single-movies.php.

Custom field template tags

There are two template tags provided for the custom fields.

the_ept_field

The template tag the_ept_field is used to echo the formatted contents of a custom field.

the_ept_field( field_key [, extra_options ] )
  • field_key - a string that is the key for the field
  • extra_options (optional) - an array with key and values to pass extra options

Example

In your theme directory, edit the single.php or single-.php template to add the fields to. Add the code below (with the correct field key) into the template where you want the field to display.

the_ept_field('my_custom_field');

get_ept_field

The template tag get_ept_field is used to get the formatted contents of a custom field without echoing the value.

get_ept_field( field_key [, extra_options ] )
  • field_key - a string that is the key for the field
  • extra_options (optional) - an array with key and values to pass extra options

Example

$mcf = get_ept_field('my_custom_field');
echo $mcf;

// Get the unformatted value of the field
$mcf = get_ept_field('mu_custom_field', array('raw' => 'true') );
var_dump($mcf); // let's see what we get back