WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
Query child posts fields (1 post)

  1. waynmeyer
    Member
    Posted 1 year ago #

    Hi Dev friends.

    Im currently loving this plugin, its made my life so easy. I would like to know how can i display images from child posts group fields....i have tried various ways and searched everywhere im down two days and still cant figure this out. Please could you help me it would be greatly appreciated.

    Here is the code im using

    <?php while ( have_posts() ) : the_post(); ?>

    <h1><?php the_field('about_your_company'); ?></h1>

    <img src="<?php the_field('business_logo'); ?>" class="hero-image" />

    <p><?php the_content(); ?></p>

    <?php $child_posts = types_child_posts('restaurant-menu');
    foreach ($child_posts as $child_post) {
    echo $child_post->post_title; echo $child_post->fields['food_price'][0]; echo $child_post->fields['food_image'][0];
    } ?>

    <?php endwhile; // end of the loop. ?>

    As you can see im building a restaurant menu with repeater fields. Im able to get the post data fields, however the image comes thorough RAW just a URL. i need the image to be an object. I have been trying the wpcf-name, this didnt work, i tried the url="false" this didnt work either. Unles im doing it wrong, hence im here for advice.

    Im building a mobile app with wordpress as CMS and a themeswitcher for mobile views where the front end will be an "app builder" for clients. Thank you for a great plugin and add-ons, this is really a must have for any new developers looking to explore template design.

    Kind regards
    Wayne -"types biggest new fan" :)

    http://wordpress.org/extend/plugins/types/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.