I added Header to the Appearance item on the management screen in WordPress and clicked on the Header.
If it goes well, you should be able to verify that the current main image on the front page is being previewed.
However, this time the following message came out and the preview could not be confirmed.
I would like to improve it so that the preview of the main image is displayed.
インストール I installed WordPress 5.1.1, and the reference book is 4.x.Version mismatch.I would like to know how to improve it.
"* I wrote ""%s"" in the image insertion area (as per reference book)."Regarding that, I received the following points from another question site.
"The URL I set to default-image contains \"%s\", but I think I'll replace it with something and then call add_theme_support."
I'm in the middle of investigating a solution.I would like to solve this as well.
<?php
add_theme_support(
'custom-header',
array(
'width' = > 950,
'height' = > 295,
'header-text' = > false,
'default-image' = > '%s/images/top/main_image.png',
)
);
Warning:sprintf():Too new arguments in Home Page Address /wp-includes/theme.php on line 915
I thought the line 915 in the wp-includes folder >theme.php might be strange in FTP of my partner server (X server), but there were no lines 915 in the first place.
We have added headers as per the text "WordPress Textbook Ver.4.x Compatible Version" (P58)
The theme of the appearance was not uploaded into FTP on the X server, but directly into WordPress.
I changed it to the following referring to the official page of wordpress, but the situation was the same (incorrect screen after error message).
*We are currently investigating the %s you pointed out.
<?php
// Custom Header
add_theme_support(
'custom-header',
$defaults=array(
'default-image' = > '%s/images/top/main_image.png',
'width' = > 950,
'height' = > 295,
'header-text' = > false,
)
);
add_theme_support('custom-header',$defaults);
The error message "Warning:sprintf():Too new arguments in Home Page Address /wp-includes/theme.php on line 915" is
It means that the number of arguments for the function sprintf() on line 915 of the homepage address /wp-includes/theme.php is too small.
Please check where you are using the specified function called sprintf().
If you don't know what the problem is, add the code around using sprintf() to your question.
=Explanation=
The sprintf function specifies the format with the first argument, followed by the variable that is converted into characters according to the format.The return value is a string.
$num=25;
$location='Tokyo';
$format='I am %d years old and live in %s';
echo sprintf($format,$num,$location);
The %d,%s used in the format (variable: $format) string is called the type specifier, which specifies what type of data to represent after the second argument.%d is a decimal (normal number) and %s is a string.
If you execute the above code, "I am 25 years old and live in Tokyo" will be displayed.
You will see that %d in the format has been replaced with a decimal value of $num and %s with a $location string.
The type specifiers in the format must correspond to their arguments.
$num=25;
$location='Tokyo';
$format='I am %d years old and live in %s';
echo sprintf($format,$num);
For example, if the format contains two typespecifiers (%d and %s), but only one argument ($num) specifies a value, the error "sprintf():Too new arguments" appears.
© 2024 OneMinuteCode. All rights reserved.