Jump to content
Sign in to follow this  
ordinaryboy

Get the page ID in custom Section

Recommended Posts

ordinaryboy    0
ordinaryboy

Hi, I'm new to pagelines but have been working with wordpress for quite a while. I am trying to create a custom section to display a bulleted list of child pages of the current page:

<?php
	/*
	Section: Child Navigation
	Author: PageLines
	Author URI: http://www.pagelines.com
	Version: 1.2.0
	Description: PageLines Child Navigation
	Class Name: ChildNavSection
	Cloning: true
	*/
	
	
	class ChildNavSection extends PageLinesSection {
	
	
	function section_template(){
	
	?>
	
	<?php
	  $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
	  if ($children) { ?>
	  
  • <?php echo $children; ?>
<?php } ?> <?php } } /* End of section class - No closing php tag needed */ [/code]

The post ID of the current post doesn't seem to work... I'm probably going about it all wrong! Could a pagelines whiz please offer advice?

Share this post


Link to post
Share on other sites
Danny    1,327
Danny
Hi, Is the code above taken from [url="http://codex.wordpress.org/Function_Reference/wp_list_pages"]here[/url] ?

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Simon    247
Simon
You need to call the global first before you try and access the object.: [code]global $post;[/code]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×