Array data wordpress

S6 56
2

Hello, has created its own type of portfolio entries, they have a column from a given section you want to display items.

I am trying to do so:

 <? Php 
$ Args = array ( 'numberposts' => 4, 'post_type' => 'portfolio', 'suppress_filters' => true, 'portfolio-category' => 17);
$ Posts = get_posts ($ args);
foreach ($ posts as $ post)
{Setup_postdata ($ post);
?>

And even do not want my output

ssylkawp-admin / term.php? taxonomy = portfolio-category & tag_ID = 17 & post_type = portfolio & wp_http_referer =% 2Fwp-admin% 2Fedit-tags.php% 3Ftaxonomy% 3Dportfolio-category% 26post_type% 3Dportfolio (a reference to the change of category)

Avatar 327
#1
sd68rus:
'Portfolio-category' * => * 17

'Tag_id' => 17

Avatar 89
#2

sd68rus,


$ Posts = get_posts ([ 'Numberposts' => 4
'Post_type' => 'portfolio',
'Tax_query' => [[ 'Taxonomy' => 'portfolio-category',
'Terms' => 17,
]],
]);

or


$ Posts = get_posts ([ 'Numberposts' => 4
'Post_type' => 'portfolio',
'Portfolio-category' => 'slug_kategorii'
]);

where "slug_kategorii" - a category label, recording where you want to get.

S6 56
#3
Gerga:
sd68rus,

$ Posts = get_posts ([ 'Numberposts' => 4
'Post_type' => 'portfolio',
'Tax_query' => [[ 'Taxonomy' => 'portfolio-category',
'Terms' => 17,
]],
]);


or


$ Posts = get_posts ([ 'Numberposts' => 4
'Post_type' => 'portfolio',
'Portfolio-category' => 'slug_kategorii'
]);


where "slug_kategorii" - a category label, recording where you want to get.

From the heart, the first option has helped. At last!

To post a new comment, please log in or register