Theming examples

1. Object gallery / listing page

For the object listing page, just use a Loop for the object custom post type:

$args = array( 'post_type' => 'object', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
 the_title();
 echo '<div class="entry-content">';
 
 // display you stuff here
 
 echo '</div>';
endwhile;

2. Single object page

For a single object page, create a page called single-object.php in your theme folder and then drop in the fields you want to display.

There are several ways of doing this. Firstly, Culture Object provides some inbuilt functions to get and display data:

cos_get_field(“[FIELDNAME]”) fetches the data so you can check it exists (as in above snippet) or assign it to a variable.

cos_the_field(“[FIELDNAME]”) displays the data

cos_get_remapped_field_name(“[FIELDNAME]”) fetches the name of the field as defined in the Field Mappings section of the CultureObject Provider Settings page. This allows you to easily define the display names for each field so they are more user friendly than the original field names.

Note that the remapping isn’t (yet) available for all providers.

So an example:

 <?php if(cos_get_field("objectNumber")){ ?>
 
 <dt><?php echo cos_get_remapped_field_name("objectNumber"); ?></dt>
 
 <dd><?php cos_the_field("objectNumber");?></dd>
 
 <?php } ?>

Or: we’re particular fans of the amazing Advanced Custom Fields plugin which also provides you with user-friendly field UI’s in the dashboard. In this instance you could just display fields like this:

$somefield = get_field("the_field_name");

echo $somefield;

Or you could use the get_post_meta function, and then do something like this:

$meta = get_post_meta(get_the_ID());

$somefield = $meta['the_field_name'][0];

echo $somefield;

..or similar.

3. Searching

We particularly like the Relevanssi plugin for advanced search – it’s well documented, has great support, and allows you to do things like filtering on custom post types or by custom fields.

Other plugins are available, and possibly allow you to do similar things.

Once this stuff is in place, you can then allow your users to search or filter by/on particular fields.