darrrrUC
darrrrUC

Reputation: 311

wp_list_pages as text not link

im doing the follow to get the children of the page im currently administrating:

    $args = array(
    'depth' => 0,
    'child_of' => get_the_ID(),
    'title_li' => '',
    'echo' => 0,
);

wp_list_pages($args);

The output is the title of the subpages and it is linked, what i wish to do is to serperate the title and the link so the output would be something like "http://thelink.com title".

Is this possible?

Regards, Emil

Upvotes: 1

Views: 421

Answers (1)

Noman
Noman

Reputation: 4116

Here you go, Enjoy

if $post->ID and get_the_ID() same then use $post->ID

global $post;
$currentPageID = $post->ID;

    $Childpages = get_pages('sort_column=menu_order&hierarchical=0&parent=' . $currentPageID . '&exclude=');

foreach ($Childpages as $page){
echo "Child Page ID: ".$page->ID ."<br>";
echo "Child Page Name: ".$page->post_title ."<br>";
}

Upvotes: 2

Related Questions