Hiya,
This indicates that the function name has been used before, try something like this instead:
function wp4327894732890_align_wide() {
add_theme_support( ‘align-wide’ );
}
add_action( ‘after_setup_theme’, ‘wp4327894732890_align_wide’ )
Thanks, Marius. Appreciate your input.
So it sounds like the function name “wp4327894732890_align_wide” is arbitrary, and just needs to match the parameter in the add_action function?
I tried using the following code:
// Add 'alignfull'
function arrovox_align_wide() {
add_theme_support( ‘align-wide’ );
}
add_action( ‘after_setup_theme’, ‘arrovox_align_wide’)
However, when I tried to update the functions.php file, I received the following error message:
Your PHP code changes were rolled back due to an error on line 41 of file wp-content/themes/genesis-sample-1/functions.php. Please fix and try saving again.
syntax error, unexpected ‘require_once’ (T_REQUIRE_ONCE)
This is the code on line 41.
require_once get_stylesheet_directory() . '/lib/helper-functions.php';
When I remove all the Alignfull code references from above, I can update the functions.php file fine.
Any idea what’s going on?
thanks
doug
-
This reply was modified 7 years, 8 months ago by
MemeRunner.
Hi,
I see that some fancy quotes are being added somehow, try typing it manually, instead of copy-pasting, and see if it works better for you then 🙂
Thanks, Marius, but typed it in by hand, and still getting the same error message:
Your PHP code changes were rolled back due to an error on line 39 of file wp-content/themes/genesis-sample-1/functions.php. Please fix and try saving again.
syntax error, unexpected ‘require_once’ (T_REQUIRE_ONCE)
Line 39 of functions.php is:
require_once get_stylesheet_directory() . '/lib/helper-functions.php';
When you mention you’re seeing additional quotes, I’m not seeing any difference between what you wrote and my version. Can you tell me what quotes you’re referring to?
thanks
doug
I’ve typed it out anew, let’s see if this one works better 🙂
function wp4327894732890_align_wide() {
add_theme_support( 'align-wide' );
}
add_action( 'after_setup_theme', 'wp4327894732890_align_wide' );
Apologies for the extra work, obviously not our intention 🙂
Thanks, Marius. Appreciate you clarifying that. And functions.php accepted it, so that was it!
I’ve added the CSS for .alignfull and .alignwide, and then entered the alignfull CLASS into the block additional CSS field. However the image is only extends to the left edge. It just repositioned the image to the left edge.
http://eme.88b.myftpupload.com/
I’m sure it’s something about my .alignfull CSS calc, below, as I’m playing around with the values and getting various results, but haven’t been able to get the image to extend to both the left and right edges.
Can you tell what the problem might be?
.entry-content .alignfull {
margin-left : calc( -100vw / 2 + 100% / 2 );
margin-right : calc( -100vw / 2 + 100% / 2 );
max-width : 100vw;
}
.entry-content .alignwide {
margin-left : -100px;
margin-right : -100px;
max-width : 1024px;
}
Your .alignfull needs a width declaration as well, try a width: auto;.
That was it. Fantastic. Thanks, Marius!