• Hi everyone, yet another noob here, sorry folks πŸ™‚
    I’ve searched and tryed to learn but I think its quite out of my reach just now..can’t get this to work.

    I’m setting up a sort of catalogue made of pages (category of products) and subpages (singles product entry). Each single product page uses custom field to store an image, a brief description, a tech note and some other things.
    An example structure to be clear:

    • Products
    • Irrigation
    • Indoor
    • prodcut 01
    • prodcut 02
    • prodcut 03
    • Outdoor
    • prodcut 01
    • prodcut 02
    • prodcut 03

    So far I’ve used Autonav plugin on main category pages (like “Products” and “Indoor”) to display subpages as thumbnails and this works pretty good as the subpages have an image attached in the post content and the plug-in can extract it. But the plugin fails on listing single product pages as they don’t have images attached in post content to extract but instead have images referenced in custom fields.
    So here’s the question: is there a way to list child pages like Autonav but taking the thumbnail from a custom field ?

    The code I put in the loop of template page I use for main category for now is

    <?php
     global $wpdb;
     $children = $wpdb->get_results("SELECT * from $wpdb->posts WHERE post_type='page' AND post_parent=$post->ID ORDER BY post_title");
      if($children) {
           foreach($children as $child) {
    	     	 	 $pagelink = get_permalink($child->ID);
    			 $page_thumb = get_post_meta($child->ID, "_simple_fields_fieldGroupID_1_fieldID_5_numInSet_0", true);
    			 $thumb = wp_get_attachment_image_src( $page_thumb, thumbnail ); ?>
    			 <img src="<?php echo $thumb[0] ?>"
    			<a href="<?php echo $pagelink ?>">link</a>
    
    	<?php } ?>
     <?php } ?>

    Am I doing it right ? Is there a more efficient or practical way to do this ? Maybe some other plugin ?
    Thanks to anyone that would like to reply.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List subpages with thumbnail from custom field’ is closed to new replies.