GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech Wordpress: One line of php. Can anyone help? (https://gfy.com/showthread.php?t=1319897)

hausarzt 11-19-2019 04:07 AM

Wordpress: One line of php. Can anyone help?
 
Hey guys.
I recently bought a Wordpress theme from a couple of guys who do not have such a good reputation here in the forum.
The support, unfortunately, does not answer, so I'm here to ask if anyone can help with a line php.

Google says the video-tag for "thumbnailUrl" is missing. This sucks, because the theme is meant for videos.

This is the code on the theme:
Code:

<meta itemprop="thumbnailUrl" content="<?php echo $thumb; ?>" />
This is the output on my site:
Code:

<meta itemprop="thumbnailUrl" content="" />
Yepp, I have added a featured image/thumbnail to each post, but somehow there is no output. So i guess, there is a small glitch in the php code.
I tried several codes, to get at least something.
Example:
Code:

<meta itemprop="thumbnailUrl" content="<?php echo $get_the_post_thumbnail_url; ?>" />

<meta itemprop="thumbnailUrl" content="<?php echo the_post_thumbnail_url; ?>" />

I even tried this, just for a test, if anything comes up:
Code:

<meta itemprop="thumbnailUrl" content="<?php echo $title; ?>" />
And, voila, I get the title of the post. So basically the meta itemprop="thumbnailUrl" content=" is correct, only the php-part is not.

Solution?

Paul&John 11-19-2019 04:22 AM

I'm going offline now but get_the_post_thumbnail_url and the_post_thumbnail_url are functions so you call them like this
Code:

<?php get_the_post_thumbnail_url(); ?>
<?php the_post_thumbnail_url(); ?>

Check the WP reference for usage (image size etc):
https://developer.wordpress.org/refe...thumbnail_url/
https://developer.wordpress.org/refe...thumbnail_url/

hausarzt 11-19-2019 04:37 AM

Quote:

Originally Posted by Paul&John (Post 22563264)
I'm going offline now but get_the_post_thumbnail_url and the_post_thumbnail_url are functions so you call them like this
Code:

<?php get_the_post_thumbnail_url(); ?>
<?php the_post_thumbnail_url(); ?>

Check the WP reference for usage (image size etc):
https://developer.wordpress.org/refe...thumbnail_url/
https://developer.wordpress.org/refe...thumbnail_url/

Yepp, already tried both. No success.

awxm 11-19-2019 08:56 AM

I had a similar problem recently. Does the theme use custom fields for images rather than native wordpress featured images perhaps?

*edit*
If you are talking about a WP-Script theme, copy the featured image url to "Main thumbnail" block and update post.

Kittens 11-19-2019 10:42 AM

Quote:

Originally Posted by hausarzt (Post 22563260)
Wordpress: One line of php. Can anyone help?

Delete wordpress.

blackmonsters 11-19-2019 07:58 PM

<meta itemprop="thumbnailUrl" content="<?php echo get_the_post_thumbnail_url(); ?>" />

<meta itemprop="thumbnailUrl" content="<?php the_post_thumbnail_url(); ?>" />



:2 cents:

hausarzt 11-20-2019 08:00 AM

Quote:

Originally Posted by awxm (Post 22563364)
I had a similar problem recently. Does the theme use custom fields for images rather than native wordpress featured images perhaps?

*edit*
If you are talking about a WP-Script theme, copy the featured image url to "Main thumbnail" block and update post.

That did the trick :thumbsup

j3rkules 11-20-2019 12:32 PM

Quote:

Originally Posted by hausarzt (Post 22563886)
That did the trick :thumbsup

:thumbsup


All times are GMT -7. The time now is 12:10 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc