Support » Plugins » Syntax error for simple plugin I want to develop

  • Hi All,

    I am totally new to Plugin development.

    What I basically did is I copied a snippet of code I want to reuse as a plugin and call it via a function.

    I am not sure what ls wrong here but basically it does not work.

    Can you please review and point me to the line I need to correct.

    Plugin Name: Children Menu
    Plugin URI:
    Description: This is a really simple script to display children only link navigation for secondary pages
    Version: 1.0
    Author URI:
    Update Server:
    Min WP Version: 3.2.1
    Max WP Version:
    function children_menu() {
    	global $post;
    	// will display the subpages of this top level page
    		$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    		$titlenamer = get_the_title($post->ID);
    	// diplays only the subpages of parent level
    	//$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    		// now you can get the the top ID of this page
    		// wp is putting the ids DESC, thats why the top level ID is the last one
    		$ancestors = end($post->ancestors);
    		$children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");
    		$titlenamer = get_the_title($post->post_parent);
    		// you will always get the whole subpages list
    if ($children) {
    echo '<div id="left-nav">';
    echo '	<ul> ';
    echo '</ul>';
    echo '</div>';
  • The topic ‘Syntax error for simple plugin I want to develop’ is closed to new replies.