get_posts from a category id doesn’t work

It’s ‘post_date’ not ‘date’ so $args = array( ‘numberposts’ => $items, ‘post_type’=>’portfolio’,’orderby’ => ‘post_date’,’order’=>’DESC’,’category’ => 5 ); $posts = get_posts($args); foreach($posts as $post){ setup_postdata($post); $return_html=”……”; } Should fix you up.

Why posts array is empty?

You don’t need to add the % signs to the value. WordPress does that for you automatically on a LIKE or NOT LIKE comparison. You also don’t need to “sanitize” the parameter, it will be automatically escaped for SQL. See wp-includes/meta.php, around line 806 or so.

Single Post in Tab/Slider

If you are using jQuery UI Tabs you can use AJAX to load the content. There is an example on the plugin page. UI Tabs is always part of a WordPress installation and registered already as jquery-ui-tabs.

Custom Post Type archive

When you’re viewing a Custom Post Type Archive, your archive-documents.php template will be used. In your case this is the URL /documents/. When you’re viewing a taxonomy term, you’re viewing a Custom Taxonomy Archive, not a Custom Post Type Archive. If you haven’t created one specific to your taxonomy, then archive.php (or index.php, if archive.php … Read more