Your problem is here:
foreach ($wqPort as $projeto)
$wqPort
is an object of type WP_Query
, not an array. If you look at your PHP error log, you should be seeing warnings and notices for those lines
Instead, use a standard post loop:
$q = new WP_Query( [ .. args here ... ] );
if ( $q->have_posts() ) {
while( $q->have_posts() ){
$q->the_post();
// .. do things
}
wp_reset_postdata();
} else {
// no posts found
}
That’s what a standard WP_Query post loop looks like
Some additional notes:
- Avoid setting suppress_filters to true, it will prevent caching mechanisms from working, as well as any plugins from adjusting the query, giving a performance penalty
- Never use
wp_rest_query
, it’s intended for use withquery_posts
. Usewp_reset_postdata
instead - Don’t smush multiple things on to the same line
- Indent your code, it will prevent common errors and make it easier to read
- If you have 2 PHP blocks with nothing in between them, don’t close and reopen them, just have 1 large block. E.g. this:
<?php echo 1; ?><?php echo 2;?>
becomes:<?php echo 1; echo 2; ?>