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

  1. Marco Panichi
    Posted 2 years 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(
    				'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))


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Posts 2 Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic