wp_list_pages - Child Psges and Editing


Ok have a question did some research and got it to work so I can put spans in my li’s which work great but in the span I have a data-hover tag and inside it I want to put the title of the page but cant figure out how. Currently have PAGETITLEHERE in the code

As well it shows all the pages when I just want to show the childs of the parent which I have done before but when changing the echo $pages to echo $children it works and shows all the children but then removes my span info.

Can anyone help heres the code…

  					$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  					$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  				if ($children) { ?>
  					<ul class="cl-effect-2" id="cl-effect-2">
	$pages = wp_list_pages('echo=0&title_li=');
	$pages = str_replace('">', '"><span data-hover="PAGETITLEHERE">', $pages);
	$pages = str_replace('<span data-hover="PAGETITLEHERE"><a', '<a', $pages);
	$pages = str_replace('</a>', '</span></a>', $pages);
	echo $pages;
  			<?php } ?>

And here is the link to the page…


So need it to just show the children of that page and still have the same effect does now and the data-hover should equal the page title so when you rollover it you see it.



Anyone able to help, can’t seem to figure it out.