TomE1428
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
| Status | Topic | Supporter | Voices | Posts | Freshness |
|---|---|---|---|---|---|
|
Adding an image with a custom field URL in PHP
Started by: TomE1428
in: Toolset Professional Support
Problem: Solution:
<?php
// Retrieve the custom field value
$youtube_video_url = get_post_meta(get_the_ID(), 'wpcf-youtube-video', true);
// Check if the custom field has a value
if (!empty($youtube_video_url)) {
// Echo the clickable image
echo '<a href="' . esc_url($youtube_video_url) . '"><img src="---" width="30" style="margin-bottom:-10px;"/></a>';
} else {
// Optionally, display something else if the custom field is empty
echo 'No video link available.';
}
?>
Note that with Toolset custom fields, you need to use the 'wpcf-' prefix before the field slug. It’s also good practice to use esc_url() to escape the URL for security purposes. |
|
2 | 3 | 2 years, 10 months ago | |
|
Views search form triggers missing form label error on WAVE
Started by: TomE1428 in: Toolset Professional Support |
|
2 | 9 | 3 years, 10 months ago | |
|
Image Slider Block
Started by: TomE1428 in: Toolset Professional Support |
|
2 | 2 | 4 years, 4 months ago |