Support

Account

Home Forums Front-end Issues Display all posts with special treatment for relationships Reply To: Display all posts with special treatment for relationships

  • Hi @elliot

    Yes, I’m trying to get an array, but can’t figure out how. When I print_r, as you requested, I get one sad ID.

    WP_Post Object
    (
        [ID] => 229
        [post_author] => 3
        [post_date] => 2014-01-17 04:25:49
        [post_date_gmt] => 2014-01-17 09:25:49
        [post_content] => 
        [post_title] => Usability
        [post_excerpt] => 
        [post_status] => publish
        [comment_status] => closed
        [ping_status] => closed
        [post_password] => 
        [post_name] => usability
        [to_ping] => 
        [pinged] => 
        [post_modified] => 2014-01-20 09:46:18
        [post_modified_gmt] => 2014-01-20 14:46:18
        [post_content_filtered] => 
        [post_parent] => 0
        [menu_order] => 0
        [post_type] => values
        [post_mime_type] => 
        [comment_count] => 0
        [filter] => raw
    )

    I’ve been trying to get 229, 233, 150, 239, 134, 221, 223, because I was able to echo it once…

                        
    <?php 
    // Values this strategy does NOT impact
    // strategy_impact = repeater
    // impact_value_select = post_object
    // custom_value_description = text not used here, but elsewhere           
                        if ( get_field('strategy_impact') ): ?>
                            <?php while(has_sub_field('strategy_impact')) : ?>
                            <?php 
                                $impact_values = get_sub_field('impact_value_select'); 
                                $impact_IDs = array($impact_values->ID);
                                $impact_IDs_comma = implode(",", $impact_IDs); ?>
                            <?php $the_thing = $impact_values->ID.','; ?>
                            <?php
                            echo $the_thing
                            ?>
                        <?php endwhile; ?>  
    

    I get 229, 233, 150, 239, 134, 221, 223,

    I wish I could get that into the “post__not_in” parameter, but after the endwhile …

    Sorry if I’m going the taking the long route in the wrong direction.

    What I’m really trying to accomplish is to get a full list of the “values” post_type but change the class/appearance of the posts based on whether or not they are post_objects of the current page, as determined by the strategy_impact sub-field.

    Even if what I’m trying here works, it’s not the ideal way to do it because it generates two lists instead of one — one that’s all the objects, one that’s not all the objects — instead of one list where objects are given different classes than the others.