get_item_by_id
returns the database record for an Item with a given ID.
Usage
<?php get_item_by_id($id); ?>
Parameters
- $id (integer) - The ID of the item you wish to retrieve. This should be a number, ideally matching the ID of an item already existing in your archive.
Example
Using get_item_by_id
, you can display metadata for a specific item anywhere in your theme. The following code will set the current item to be the item with an ID of 7, and will then echo the title of that item, wrapped in an h2
tag.
<?php set_current_item(get_item_by_id(7)); echo '<h2>'.item('Dublin Core', 'Title').'</h2>'; ?>