Site logo

Archived topic

Question about Child Theme

3 replies · Started by Andi on July 25, 2016

Viewing posts 1–4 of 4

Hi Tom,

I want to change the login error message to WordPress so a hacker won't get an idea if the user name or the password is wrong.
- I learned about child themes: https://codex.wordpress.org/Child_Themes
- I learned I don't have to add the enqueue code because GP takes care of all that automatically: https://generatepress.com/forums/topic/gp-child-theme/
- I found a code to add in a WP forum:
// Modify WordPress Login Error Messages for Better Security
function new_login_error()
{
return 'Login fehlgeschlagen: Bitte Username und Password checken.';
}
add_filter( 'login_errors', 'new_login_error' );
- I found that the only thing you added to the functons.php is the opening tag '<?php' and a multi line comment (the stuff between '/*' and '*/').

Now my two simple questions are:
--------------------------------
- Do I have to add the php ending tag '?>' to the functions.php or is that also done automatically in GP?
- Why is the styles.css not called style.css as it says in the wordpress.org article about child themes (see link above)? Is that a typo (as I found a message in one forum saying this) or what is the reason this file is named differently than the standard?

Thanks,
Andi

Hi Andi,

The closing PHP tag isn't required by PHP - I usually don't add it.

GP detects if you're using a child theme and adds the core style.css file for you so you don't have to.

Let me know if you need more info :)

Hi Tom,

thanks for the quick reply!

a) Thanks for letting me that GP adds the style.css on it's own. But I still don't get the difference between the included styles.css (with the s in the name, the one that's in your child zip file) and the automatically created style.css (without the s in the name).

b) Via ftp I created a folder generatepress-child in the folder wp-content/themes and put the two files from your zip-file in there (styles.css and functions.php) after adding my little code from above to the php-file.

Under Appearance / Themes I couldn't choose the child theme, there is only GPv1.34.
I thought maybe I need to log out and log in again so WordPress scans the themes folder again, but no, still only GP, not the child theme to choose. Also I noticed that the style.css is not automatically created yet.

Am I missing a step? I thought as soon as I created the child folder with the two files I could choose this child theme in the WordPress dashboard under Appearance / Themes (at least that's what they say in the article https://codex.wordpress.org/Child_Themes).

Thanks a lot,
Andi

This archived topic is closed to new replies.