[Resolved] Added a new item inside mobile menu — search doesn't hide it

Home Forums Support [Resolved] Added a new item inside mobile menu — search doesn't hide it

Home Forums Support Added a new item inside mobile menu — search doesn't hide it

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #318124
    Mikko

    Hello!

    I’m very happy with GeneratePress and GP Premium.

    My site is here:
    https://mihku.fi/ihmettele/

    There are two blogs on the site, made with different categories. I wanted to add the blog name inside mobile menu, so that people could easily return to the blog home page.

    This code snipped accomplished what I wanted:

    add_action( 'generate_inside_mobile_menu_bar','insert_blog_name_after_slider' );  
    function insert_blog_name_after_slider() { ?>
    	<?php if ( in_category(Ihmettele) ) : ?>
    	<a href="https://mihku.fi/ihmettele/">Ihmettele-lehti</a>
    	<?php endif; ?>
    
    	<?php if ( in_category('digiope.fi') ) : ?>
    	<a href="https://mihku.fi/digiope/">Digiope</a>
    	<?php endif; ?>
    <?php }

    One problem: when you press the search buttom, the blog name (Ihmettele-lehti) does not change color to dark gray. Help?

    Mikko

    #318222
    Tom
    Lead Developer
    Lead Developer

    That’s happening because the area that has the icon is set to display on top of the search (so we can close it).

    You can do this instead:

    add_action( 'generate_inside_navigation','insert_blog_name_after_slider' );  
    function insert_blog_name_after_slider() { ?>
    	<?php if ( in_category(Ihmettele) ) : ?>
    	<div class="mobile-bar-items custom-mobile-items"><a href="https://mihku.fi/ihmettele/">Ihmettele-lehti</a></div>
    	<?php endif; ?>
    
    	<?php if ( in_category('digiope.fi') ) : ?>
    	<div class="mobile-bar-items custom-mobile-items"><a href="https://mihku.fi/digiope/">Digiope</a></div>
    	<?php endif; ?>
    <?php }

    Then add this CSS:

    .mobile-bar-items.custom-mobile-items {
        z-idnex: 1;
    }
    #318236
    Mikko

    Oh yes, perfect! Thank you.

    I love the flexibility of the theme. PHP is new to me, and it seems to open all kinds of doors.

    #318244
    Tom
    Lead Developer
    Lead Developer

    You’re welcome!

    Once you start understanding PHP, pretty much anything is possible 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.