As part of my recent mini project, I needed to add certain meta data to different posts and pages; for example a thumbnail image for a gallery, image captions etc… In order to do this I used a great free plug-in called ‘Custom Fields‘. After you install the plug-in you can create custom meta data that you can add to a page. The clever bit about the plug-in is you can use condition logic to decide where your custom fields get applied, for example, for each different category you have you can automatically have different meta-data. If you want to know more about the plug-in go through the plug-ins documentation as it is quite extensive.
In your code you can then iterate through your posts/pages and get the meta-data from the page, using the following snippet :
Using this plug-in I was very easily and quickly able to create a custom products gallery that linked to a details page. Full code example below :
$child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> ID); $link = !empty($pdf) ? $pdf : get_permalink($pageChild->ID); ?>