Home Forums General Issues Post object / custom post type


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).

    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.

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

The topic ‘Post object / custom post type’ is closed to new replies.