Site logo

Archived topic

Child theme loses menu in mobile view

11 replies · Started by Anonymous on July 22, 2016

Viewing posts 1–12 of 12

Hi,

I'm fairly new to WP. I've created a child theme of GP, but when viewed on mobile it doesn't display the menu. When I switch back to GP it works fine. I've searched for the @import url(“../generatepress/style.css”); line as discussed in other answers, but it's not used, so that's not the problem. Any suggestion as to where to start looking?

Do you have anything in your functions.php file?

Yes, I have the following:


<?php
/**
 * Enqueue scripts and styles
 */
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() 
{
	// Enqueue our CSS.
	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}
?>

Ah yes, you'll want to remove that so only this exists in the file:

<?php

GP adds the parent style.css file for you - so that function is doing it for a second time which is causing the issue.

I tried
<?php
but the site doesn't load.
I presume you mean

<?php
?>

I currently have that, but the menu still doesn't work.

Hmm, that closing ?> shouldn't be necessary.

Maybe it just wants an extra line:

<?php
// PHP code below this line

If I put the REM statement in, or just leave a blank line it loads the page. If I only have 1 line, opening the php statement, it fails to load the page.
However, the menu still doesn't display.

Can you link me to the site so I can take a look?

This is still happening because your child style.css has all of the parent CSS in it.

Your child theme style.css should only contain your custom CSS - nothing else.

Yes, thank you. It's obvious now you point it out. Thanks for all your help.

You're welcome :)

This archived topic is closed to new replies.