I need to create some pages with a custom field called categoria-pagina so I can display a list of these pages and their excerpt on my theme's index.php. I have already tried the code bellow, but if I use the args it doesn't display anything.
<?php
$args = array(
'meta_key' => 'categoria-pagina',
'meta_value' => 'programas'
);
$pages = get_pages($args);
foreach ($pages as $page) {
echo "<p>$page->post_title</p>";
}
wp_reset_postdata();
?>