WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
Why my ordered query doesn't work? (1 post)

  1. Marco Panichi
    Member
    Posted 10 months ago #

    This is my query:

    $query = new WP_Query( array(
    	'post_type' => 'portfolio',
    	'connected_type' => 'portfolio_to_page',
    	'connected_direction' => 'to',
    	'connected_items' => $id,
    	'suppress_filters' => false,
    	'nopaging' => true,
    	'connected_orderby' => 'data',
    	'connected_order' => 'desc',
    	'connected_order_num' => true,
    ) );

    Everthing works correctly, but the posts aren't ordered.

    data is a meta created with the meta box plugin. Here's the code used to create the field:

    function register_portfolio_meta_boxes()
    {
    
    	$prefix = '';
    
    	new RW_Meta_Box(array(
    		'title'  => 'Scheda tecnica',
    		'desc'   => 'Dettagli tecnici del lavoro svolto',
    		'pages'  => array( 'portfolio' ),
    		'fields' => array(
    			array(
    				'name' => 'Data di completamento (MM/AAAA)',
    				'id'   => $prefix.'data',
    				'type' => 'date'
    			),
    			...
    		)
    	));
    
    }
    
    add_action('admin_init', 'register_portfolio_meta_boxes');

    As you can see I didn't set any prefix, but I don't think it is the problem because I can easly render the field in the theme files (get_post_meta($post->ID, 'data', true))

    http://wordpress.org/extend/plugins/posts-to-posts/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 10 months ago by Marco Panichi
  • This topic is not resolved
  • WordPress version: 3.5.1