- This topic has 29 replies, 4 voices, and was last updated 4 years, 6 months ago by Leo.
-
AuthorPosts
-
October 19, 2019 at 4:49 pm #1039275Matias
Im using the Child theme downloaded from GP Help Documents and works great.
Troubles starts when I add some php code inOctober 19, 2019 at 8:12 pm #1039314TomLead DeveloperLead DeveloperAny PHP code? Or just a specific function?
October 20, 2019 at 3:06 am #1039415MatiasExemple, If I add this one:
add_filter( ‘generate_google_font_display’, function() { return ‘swap’; } );
I get a error
October 20, 2019 at 5:12 am #1039462DavidStaffCustomer SupportCan you try this:
add_filter( 'generate_google_font_display', function() { return 'swap'; } );
the difference is the upright apostrophes …..
October 21, 2019 at 10:19 am #1040534MatiasNothing.
I have copied your code to the function file in GP child Theme and the problems followsAn error of type E_PARSE occurred on line 1 of the file /home/tecnoped/public_html/tecnopeda.com/wp-content/themes/generatepress_child/functions.php. Error message: syntax error, unexpected ‘function’ (T_FUNCTION)
October 21, 2019 at 1:12 pm #1040684LeoStaffCustomer SupportJust tried the exact snippet and didn’t receive an error.
Are there any other functions in the file?
October 21, 2019 at 1:15 pm #1040691MatiasNo, just the code of the original functions File of GP Child Theme
October 21, 2019 at 1:16 pm #1040693LeoStaffCustomer SupportCan you take a screenshot of your
function.php
file?You can upload it using a service like this:
https://postimages.org/October 21, 2019 at 1:20 pm #1040694MatiasThis is de code in the functions File of the GP Child Theme downloaded from Help docs in GP site
<?php /** * GeneratePress child theme functions and definitions. * * Add your custom PHP in this file. * Only edit this file if you have direct access to it on your server (to fix errors if they happen). */ function generatepress_child_enqueue_scripts() { if ( is_rtl() ) { wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' ); } } add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
October 21, 2019 at 4:49 pm #1040786TomLead DeveloperLead DeveloperThe error is saying line 1, and line 1 is this:
<?php
There definitely isn’t an error there.
What program are you using to edit the file? Maybe there’s some sort of encoding issue going on with the program/language you’re using?
October 21, 2019 at 5:00 pm #1040798MatiasNotepad++
I havent had problems adding code in function with Genesis Framework, but I will check itOctober 21, 2019 at 5:33 pm #1040822MatiasChecked and the problems still follows
Notepad++ is in UTF8 and ANSI encoding and I got the same errorOctober 22, 2019 at 9:06 am #1041539TomLead DeveloperLead DeveloperSomething must be corrupt, as the error is pointing to line 1, which is the opening PHP tag:
<?php
Maybe your FTP program? It’s super hard to guess like this, unfortunately.
If you use the same functions in the Code Snippets plugin, do they work?
October 22, 2019 at 10:36 am #1041617MatiasYes, with Code Snippets works fine.
Can I add the functions with the plugins and disable it them?
October 22, 2019 at 10:43 am #1041622LeoStaffCustomer SupportUnfortunately not.
The snippets would be deactivate when the plugin is disabled.
-
AuthorPosts
- You must be logged in to reply to this topic.