Answer the question
In order to leave comments, you need to log in
Can't output a string in a function, what's wrong?
Please poke your nose into the guide.
The result of this function is not what I imagined it to be.
This is how it [function] should work:
But in fact, this is what happens:
Here is the function itself:<meta content="http://domain.com/image.jpg"/>
http://domain.com/image.jpg<meta content=""/>
function meta_image() {
$default_img = is_singular() && has_post_thumbnail() ? the_post_thumbnail_url() : get_theme_mod( 'ktps_image_uploader_output' );
echo '<meta content="' . $default_img . '" />';
}
add_action( 'wp_head', 'meta_image' );
Answer the question
In order to leave comments, you need to log in
$default_img = is_singular() && has_post_thumbnail() ? the_post_thumbnail_url() : get_theme_mod( 'ktps_image_uploader_output' );
get_the_post_thumbnail_url()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question