WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Child posts doesn't work (8 posts)

  1. Sebafaim
    Member
    Posted 11 months ago #

    Sorry for my english, it's not native language.
    I used this tutorial with the 1.3 version of Types.
    It worked perfectly with the 1.3, but with the 1.4.1 it doesn't work, the post doesn't display the content of each child, but only the content of the last child's post on each post.

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

  2. Sebafaim
    Member
    Posted 11 months ago #

    This is the code I use :

    <?php
    $child_posts = types_child_posts('photo');
    foreach ($child_posts as $child_post) {
    $imgTitle = $child_post->post_title;
    $imgUrl = $child_post->fields['photo-test'];
    $imgDesc = $child_post->fields['photo-desc'];

    $path_parts = pathinfo($child_post->fields['photo-test']); //just for miniature
    $chemintest = $path_parts['dirname']; //just for miniature
    $filenametest = "/".$path_parts['filename']; //just for miniature
    $miniaturetest = $chemintest.$filenametest."-40x25.jpg"; //just for miniature
    echo '<;a href="'.$imgUrl.'" title="'.$imgDesc.'"><img src="'.$miniaturetest.'" alt="'.$imgTitle.'" height="25" width="40"/>'</;a>;
    }
    /?>

  3. Grsmto
    Member
    Posted 11 months ago #

    Same issue here.

    I spent hours reinstalling my wordpress website, but after few debugs, it definitely comes from the plugin last update.

    It was working great before update.

  4. Colir
    Member
    Posted 11 months ago #

    same here... +1

  5. Srdjan
    Member
    Plugin Author

    Posted 10 months ago #

    Hi all,
    so call stopped working after update and custom code did not change?
    Can you please paste how you're using API call and short description where you're using it?

    Also, is there something specific regarding children post types (post statuses, are they publicly queryable…)?

    We checked possible changes that could provoke it, but could not see anything wrong. On our tests everything worked fine. We'll see how to reproduce this and see what needs to be fixed.

  6. Srdjan
    Member
    Plugin Author

    Posted 10 months ago #

    Hi everybody,
    there is some wrong caching in this API function.
    It's fixed for next release.

    Temporary fix is to add these arguments:

    types_child_posts( $child_post_type, array(
        'meta_key' => '_wpcf_belongs_{$parent_post_type}_id',
        'meta_value' => $parent_post_id,
    ));
  7. Grsmto
    Member
    Posted 9 months ago #

    Temporary fix works, thank you!

    Don't know why but I had to use '_wpcf_belongs_'.$parent_post_type.'_id' instead of '_wpcf_belongs_{$parent_post_type}_id' .

  8. Srdjan
    Member
    Plugin Author

    Posted 9 months ago #

    sorry, I used single quotes instead of double (that's why it failed).

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.