Frage

I am working on building a side menu using the php that was offered in the wordpress codex. The issue that I am having is that the code has a title and I am unable to remove it without breaking the menu. The following code works perfectly except for the title that displays.

'title_li' => 'Tree of Parent Page ' . $parent,

The full code I am using:

<?php
$parent = 122;
$args=array(
'child_of' => $parent
);
$pages = get_pages($args);  
if ($pages) {
 $pageids = array();
foreach ($pages as $page) {
$pageids[]= $page->ID;
}

$args=array(
 'title_li' => 'Tree of Parent Page ' . $parent,
 'include' =>  $parent . ',' . implode(",", $pageids)
);
wp_list_pages($args);
}
?>

I have tried a couple of things, the wordpress codex said that you could comment out the title_li by making it null. So I tried:

'title_li='

I also tried removing the

'tree of parent page' . $parent,

I am learning and truly appreciate the help.

8-) Thank you!

War es hilfreich?

Lösung

A couple of things you can try:

'title_li' => '',

or

'title_li' => null,

Andere Tipps

@quixrick, thank you for your answer. It turns out what was happening is that by making the title_li null, using the code:

 'title_li' => '',

The styles then changed. So the styles that I had applied to hide the children of the parents did not work. The code that I use in the above example somehow applies a li class of pagenav, when I removed the title I removed the pagenav styles.

So all I needed to do is to update the styles to get it working again, this time with out the title_li!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top