Return to Support

Child Theme – Menu & 404 edit

Home Forums Graphene WordPress theme Support Child Theme – Menu & 404 edit

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2985
    Anonymous

    Well, thanks to Prasanna, I was able to install a child theme on my site a few days ago to edit my main menu. I’m back hoping for more guidance on two more issues.

    The secondary menu defaults to all caps. I want to remove this styling but would like the font to be bold.

    Also, I want to edit my 404 message. I found the 404.php file in the main graphene files and it looked straightforward but I’m still terrified to edit any code, let alone in the main theme. Is there a way to add a 404.php file to the child theme so I can edit it there?

    #22935
    Josh
    Member

    Are you using a custom menu? Try going into each custom menu item and typing the label manually in the “Navigation label” box.

    As for editing the 404 message, it’s a bit more complicated. The best way is to use the translation method. This protects the change within the child theme. You will need to add the following function to your child theme functions.php file:

    // Change "Read the rest of this entry" link Button
    function graphene_filter_readmore( $translated, $original, $domain ) {
    $strings = array(
    'THE ORIGINAL TEXT' => 'YOUR NEW TEXT',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_readmore', 10, 3 );

    Then, replace YOUR ORIGINAL TEXT with the original text currently being used, and replace YOUR NEW TEXT with the new text you would like to display.

    #22936
    kyungs
    Member

    I just tried typing in the secondary menu item manually and it didn’t change the styling.

    I can try to change the functions.php file but before I do, my current 404 page can be seen at http://fghelper/fgh/sdlfdj/ (don’t laugh at my silly site). I want to keep the search box and everything below it. Will your instruction allow me to do that?

    #22937
    Josh
    Member

    Try adding this to your child theme stylesheet file to get rid of the uppercase:

    #secondary-menu > li {
    text-transform: none;
    }

    As for the custom funtion, everything will remain the same except for the actual text being displayed. Basically, there are three ‘text strings’ used in the content section of the 404 page. They look like this in the source code:

    <?php _e('Error 404 - Page Not Found', 'graphene'); ?>

    Displays the “Error 404 – Page Not Found” text.

    And here are the other two:

    <?php _e("Sorry, I've looked everywhere but I can't find the page you're looking for.", 'graphene'); ?>

    and

    <?php _e("If you follow the link from another website, I may have removed or renamed the page some time ago. You may want to try searching for the page:", 'graphene'); ?>

    So, if you wanted to change the “Error 404 – Page Not Found”, you would do this with the custom function:

    function graphene_filter_readmore( $translated, $original, $domain ) {
    $strings = array(
    'Error 404 - Page Not Found' => 'You have reached this page in error.',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_readmore', 10, 3 );

    This would change the error text to “You have reached this page in error”.

    #22938
    kyungs
    Member

    Thanks, Josh. I finally circled back around to this issue. It’s amazing how much ‘work’ goes into setting up a webpage… so many details! The uppercase is gone AND I even managed to figure out how to make the font bold on my own. I know, a small feat for you but a major step in bravery for me.

    I think I’m too scared to try the 404 edit. I understand what you’re saying but I’m still not sure how I create a new 404.php in the child theme but I won’t take up any more of your time on this because I know I’m just not brave enough to try it yet.

    Thanks again for your time.

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

You must be logged in to reply to this topic.