Pour les besoins d’un client, j’ai du ajouter une nouvelle fonction dans le thème Nikynik de WordPress dans le fichier BX_functions.php. Cette nouvelle fonction est basée sur celle existante BX_get_pages($with_content = ») qui permet d’afficher soit le titre de toutes les pages statiques, soit leur contenu. Celle que j’ai ajouté permet la même chose, à la différence près qu’elle permet de lister les pages enfants d’une page parent que vous aurez précisée.
For one of my client’s needs, I have created a new function in the Nikynik WordPress theme in the BX_functions.php file. This new function is based on the BX_get_pages($with_content= ») existing one which allows to display either the title or the content of all static pages. The function I added will enable you to display children pages of a choosen parent page.
function BX_get_pages_subpages($parent_page_id, $with_content = '')
{
global $wpdb;
$query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' AND post_parent=".$parent_page_id." ORDER BY menu_order ASC";
if ($with_content == "with_content") {
$query = "SELECT ID, post_title,post_name, post_content FROM " . $wpdb->posts . " WHERE post_status='static' AND post_parent=".$parent_page_id." ORDER BY menu_order ASC";
}
return $wpdb->get_results($query);
}

Pingback : Adverbe