• Resolved IestynR

    (@iestynr)


    Hey.

    Does anyone have and information as to how I can go about changing the link ‘Pages’ that’s on the top header, to just ‘About’? Right now you have to go Pages>About to access our ‘about’ sections, I’d like it just to be ‘About’ up there.

    I’m using Cleanr template, and here’s the site: https://www.thegallivantingjournals.co.uk:/blog/

    Thank you!

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter IestynR

    (@iestynr)

    Ah! Manage to change the Pages to ‘About’ – but is there any way to change the ‘About’ so that I don’t have to go About>About? No dropdown, just click on About to go to that page?

    Looks like your theme is using a custom Page dropdown. Have you tried looking in header.php for the code block that generates this dropdown?

    Thread Starter IestynR

    (@iestynr)

    Hey again esmi.

    Yeah, I’ve been inside the header.php – this is how I managed to change to ‘PAges’ to ‘About’, but unfortunately, I have no idea what the code for a dropdown looks like. Any hints as to what it might be?

    It could be anything from a block og javascript to a function call. Drop a copy of header.php into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Thread Starter IestynR

    (@iestynr)

    Awesome – thanks.

    Here’s the patsebin result:

    https://wordpress.pastebin.com/HPcpR9Sa

    I just want to get rid of the Dropdown only on the ‘About’ on the Blog, and make the ‘About’ that’s on the dropdown the only thing there, so you don’t have to go About>About.
    Thanks

    Thread Starter IestynR

    (@iestynr)

    As you can see – all I’ve done right now, is change the values on line 24 to ‘About’.

    OK – what that bit of code is doing is listing all of your Pages. Assuming that your About page has an id of 2, the first task is to exclude it from the Pages menu and hide the Pages menu if you don’t have any Pages except About. So try changing:

    <?php wp_list_pages('title_li=About'); ?>

    to:

    <?php if( wp_list_pages('title_li=&exclude=2&echo=0') ) wp_list_pages('title_li=Pages&exclude=2'); ?>

    Then you’ll need to add in an essentially hard-coded link to your About page. So just above the new line, try adding:

    <?php
    $page_id = 2; // id of the About page
    get_page( $page_id );
    $page_title = $page_data->post_title;?>
    <li class="about"<a title="<?php echo $page_title;?>" href="<?php echo get_page_link($page_id);?>"><?php echo $page_title;?></a></li>

    The whole thing should look like:

    <?php
    $page_id = 2; // id of the About page
    get_page( $page_id );
    $page_title = $page_data->post_title;?>
    <li class="about"<a title="<?php echo $page_title;?>" href="<?php echo get_page_link($page_id);?>"><?php echo $page_title;?></a></li>
    <?php if( wp_list_pages('title_li=&exclude=2&echo=0') ) wp_list_pages('title_li=Pages&exclude=2'); ?>

    At least that’s how it should work in theory, ??

    Thread Starter IestynR

    (@iestynr)

    Heya – that’s awesome that you’ve created the script for me, but unfortunately, it’s taken away the ‘About’ link all together. How do I check if the About Page has an id of 2?

    Thread Starter IestynR

    (@iestynr)

    Hey.

    Anyone got any other recommendations?

    Thread Starter IestynR

    (@iestynr)

    Thanks for the link esmi – you’re correct, the post id is 2. HAve you got any idea why it wouldn’t work?

    Just realised – I messed up the list/link markup! ?? Try:

    <li class="about"><a title="<?php echo $page_title;?>" href="<?php echo get_page_link($page_id);?>"><?php echo $page_title;?></a></li>

    Thread Starter IestynR

    (@iestynr)

    Nope ?? Still no luck I’m afraid. Any other suggestions?

    Have you checked the page source? Is anything being generated?

    Thread Starter IestynR

    (@iestynr)

    The post id is 2 for the About page, but I’ve also changed the slug to ‘about-us’.

    On the code above, you say, for example: get_page( $page_id ); should ‘$page_id’ here be ‘about-us’?

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘How to I change the 'Pages' dropdown?’ is closed to new replies.