1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

help: Wordpress menu - Pages and subpages

Discussion in 'WordPress' started by theivo, Jan 18, 2009.

  1. #1
    Hi,
    Can someone to help me how to do something like this - I'm using Wordpress like CMS.
    So I got main vertical menu from pages and subpages. I need one simple thing - want subpages to be shown in menu only when you click at it's parent page.
    Something like this:

    Page1
    Page2
    Page3


    and when I press Page2 to look like this

    Page1
    Page2
    >Subpage
    >Subpage

    Page3


    Thanks in advance!
     
    theivo, Jan 18, 2009 IP
  2. prasetyo43

    prasetyo43 Well-Known Member

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    106
    #2
    do you try to put subpage under parent page?
     
    prasetyo43, Jan 18, 2009 IP
  3. theivo

    theivo Well-Known Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #3
    Yep, but at the moment i'm using this way in my template

    <?php wp_list_pages('title_li=&depth=1&exclude='); ?>
    Code (markup):
    I'm not very good in coding and asking about the right code to place for this effect
     
    theivo, Jan 18, 2009 IP
  4. jemekite

    jemekite Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    138
    #4
    yep... you can set it in the right side of your dashboard. Just set parent page to your Page2
     
    jemekite, Jan 18, 2009 IP
  5. arramuse

    arramuse Active Member

    Messages:
    512
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    this is right..

    Yups, You just Setup Page parent on Advance Options.
     
    arramuse, Jan 18, 2009 IP
  6. theivo

    theivo Well-Known Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #6
    Look, the parent page is set. But the problem is that i need the correct way of code I listed above.
     
    theivo, Jan 18, 2009 IP
  7. BANAGO

    BANAGO Active Member

    Messages:
    456
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #7
    This is what you need:

    This would do what you need. If it gives any error let me know so that I can test it in my server.
     
    BANAGO, Jan 18, 2009 IP
  8. theivo

    theivo Well-Known Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #8
    Parse error: syntax error, unexpected T_ELSE in
    Code (markup):
    Got problem with this Else
     
    theivo, Jan 18, 2009 IP
  9. lvtim

    lvtim Well-Known Member

    Messages:
    291
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #9
    The
    <?php if (is_page()); {
    should be
    <?php if (is_page()) {

    without the semicolon
     
    lvtim, Jan 18, 2009 IP
  10. theivo

    theivo Well-Known Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #10
    Yes, it's working but in this way are shown all subpages, not only under Page2 example.
    I already got this result with

    <?php wp_list_pages('title_li=&depth=2&exclude='); ?>
    Code (markup):
     
    theivo, Jan 18, 2009 IP
  11. BANAGO

    BANAGO Active Member

    Messages:
    456
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #11
    Yes, I thought about it later that it would happen. You need to make e more complex code with child pages. I don't have time right now, I hope I can come with something in the evening.
     
    BANAGO, Jan 20, 2009 IP
  12. theivo

    theivo Well-Known Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #12
    ;) thanks for the support, do not worry, I'm on the css right now :)
     
    theivo, Jan 20, 2009 IP