Support

Account

Home Forums General Issues Post object / custom post type

Unread

Post object / custom post type

  • Hello,

    So, I have one custom post type (software) and the default post type (post). I use on software articles a post object to select articles from default post type. Now I try to show on POST1, the SOFTWARE1 article (POST1 is selected in post object on software article).

    Short:
    1x software post type
    1x default post type.

    Software use post object to link articles form default post type.
    On default post type should show software articles that have selected in post object.

    I try with custom Query, but don’t work for post object, only for text fields. The code below works only when I use a text field, with post object don’t work anymore.

    <?php 
    
    $posts = get_posts(array(
    	'numberposts'	=> -1,
    	'post_type'		=> 'software',
    	'meta_key'		=> 'main_file_extension',
    	'meta_value'	=> '.MOS'
    ));
    
    if( $posts ): ?>
    	
    	<ul>
    		
    	<?php foreach( $posts as $post ): 
    		
    		setup_postdata( $post );
    		
    		?>
    		<li>
    			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    		</li>
    	
    	<?php endforeach; ?>
    	
    	</ul>
    	
    	<?php wp_reset_postdata(); ?>
    
    <?php endif; ?>
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.