# How can I display and excerpt of all pages with a meta_key and meta_value on index.php?

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();
?>


 <?php $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'meta_key' => 'votes_count', 'orderby' => 'meta_value_num';$wp_query = new WP_Query( $args ); ?>  What does a print_r($args) return for you ?
• Also found out that you need to declare this in your args 'post_type' => 'page' – Simon Aug 27 '15 at 22:12