Support » Plugin: Page-list » Show a link to the main page on subpages

  • Pepozzo



    I’m using a code that you suggest me:

    $children = get_pages('child_of='.$post->ID);
    if( count( $children ) != 0 ) {
    	echo do_shortcode('[subpages]');
    } else {
    	// no subpages

    That works perfectly, but I would like to ask if is possible to show, on subpages, a link to the “main” page.
    I mean, i’ve this structure:
    – Product 1
    — Description
    — Requirements

    Is it possible to create a link to “Product 1” in each subpage (Description and Requirements)?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author webvitalii


    Try to add this code:

    echo '<a href="'.get_permalink( $post->post_parent ).'">';
    echo get_the_title( $post->ID );
    echo '</a>';


    Thank you for your fast reply.

    That code works fine, but i was thinking about linking directly to the main parent page (if is it possible, of course).

    Also, is it possible to show that link only if a parent page is present?

    Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show a link to the main page on subpages’ is closed to new replies.