WordPress.org

Ready to get started?Download WordPress

Forums

Decode
[resolved] Adding a page to navigation? (12 posts)

  1. cyborg4
    Member
    Posted 6 months ago #

    Hi,
    Probably a stupid question, but is there any way to add a custom item to the navigation bar (NOT the menu) at the top of the theme, underneath the title and tagline?

    Thanks!

    Curtis

  2. Jesin A
    Member
    Posted 6 months ago #

    There is a section named "Links" in Appearance > Menus to add custom links. In case you don't see it click on "Screen Options" on the top right corner and tick links.

  3. cyborg4
    Member
    Posted 6 months ago #

    Hi,

    Thanks, that's partly solved my problem, but I also want a Login/Register link to appear there if you're not logged in to /wp-login, but not when you're logged in. Is there any way to do this?

    Once again, thanks for the prompt response!

    Curtis

  4. Jesin A
    Member
    Posted 6 months ago #

    Hi Curtis,

    That would require you to modify code.

    It is highly recommended to create a child theme, activate it and place the following code in the wp-content/themes/decode-child/functions.php file.

    <?php
    add_filter('wp_nav_menu_items', 'login_logout_menu_link', 11, 2);
    function login_logout_menu_link( $items, $args ) {
        $items .= '<li>'. wp_loginout( '', FALSE ) .'</li>';
        $items .= wp_register( '<li>', '</li>', FALSE );
        return $items;
    }

    The closing PHP tag ?> should be omitted.

  5. cyborg4
    Member
    Posted 6 months ago #

    Hi,

    Where should this code be placed in functions.php? I tried it but it didn't work - the homepage just returned a blank page.

    Thanks!

    Curtis

  6. Jesin A
    Member
    Posted 6 months ago #

    Did you create and activate a child theme?

    The wp-content/themes/decode-child/functions.php file doesn't exist, you have to create one and place the code.

  7. cyborg4
    Member
    Posted 6 months ago #

    I was trying to do it in the main theme file. I have a backup of the old theme files (and the entire WP install).

  8. Jesin A
    Member
    Posted 6 months ago #

    That is not at all recommended as all changes in the main theme's files will be overwritten when you update the theme.

    If you remove the opening PHP tags <?php it'll work in the main functions.php file.

    You have been warned!

  9. cyborg4
    Member
    Posted 6 months ago #

    OK, I'll make a child theme then. Thanks, I'll reply when it's done!

  10. cyborg4
    Member
    Posted 6 months ago #

    Hi,

    Using the child theme breaks Decode. It displays in a nearly all-text manner, with only a few images remaining. It also doesn't use the right fonts.

    Any ideas?

    Curtis

  11. stephencottontail
    Member
    Posted 6 months ago #

    Did you remember to import Decode's stylesheet?

    @import url("../decode/style.css"); needs to be at the top of your child theme's style.css, right after all the header information.

  12. cyborg4
    Member
    Posted 6 months ago #

    Hi,

    Did you remember to import Decode's stylesheet?

    Yeah, I referenced it.

    But.. I have sorted the problem by adding a Login/Register widget into the sidebar in Decode. Thanks so much everyone for the help and advice, I will be continuing to use this theme and am about to give it a great review!

    Once again, thanks for the fast help!

    Curtis

Reply

You must log in to post.

About this Theme

About this Topic