WordPress Snippets at WPcustoms

Customized function to list pages

wp_list_pages() not supposed to have a title attribute by default. So we created our own list pages function. Modify to fit your needs.


/**
 * Snippet Name: Customized function to list pages
 * Snippet URL: https://wpcustoms.net/snippets/customized-function-to-list-pages/
 */
  function wpc_list_pages($param) {
  $pages = get_pages($param); 
  foreach ( $pages as $page ) {
    $li  = '
  • '; $li .= $page->post_title; $li .= '
  • '; echo $li; } }