Support

Account

Home Forums General Issues Select men on page editor and show children of that page

Helping

Select men on page editor and show children of that page

  • Hello,

    I am using this plugin on my website and I am looking to extend what I currently have and not sure how to do so…

    I currently have a menu selector on the page editor section using the advanced custom fields plugin which basically asks which menu they want to select to show on the side bar..which is what I want BUT I only want the children of that particular page to show up so for Example if Page B is a child page to Page A then I want the children of Page B to appear but if there is none then use the siblings of Page B….also if I were to use this same menu on another page it would recognize if that page is part of the menu and will display it’s children of that menu.

  • Hi @ussailing

    This is a very complex request and not one that I can fully code for you.

    You can use a post_object field to select a post. Then, in your template, you can display the child page links with the following code:

    
    <?php 
    
    $selected_post = get_field('selected_post');
    
    wp_list_pages( array(
    	'child_of'	=> $selected_post->ID
    )); 
    
     ?>
    

    ref: http://codex.wordpress.org/Function_Reference/wp_list_pages

    You will need to write your own logic to determine if no children exist.

    hope that helps.

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Select men on page editor and show children of that page’ is closed to new replies.