Hi tagDiv support team,
I’m currently facing an issue with getting my ACF (Advanced Custom Fields) image field to display correctly when using a custom shortcode inside the tagDiv Composer. Specifically, I have created a shortcode to display an album cover using ACF, and it works perfectly when added directly in the post body via the WordPress editor. However, when I try to use this shortcode within tagDiv’s Composer (e.g., inside text blocks or other visual elements), the image does not appear at all.
Here are some details about my setup:
I’ve verified that the shortcode is active and functioning and have tested different return formats (ID, Array, URL) as per ACF’s documentation, but the shortcode simply doesn’t seem to execute when used within tagDiv Composer.
Is there a specific way that tagDiv Composer handles shortcodes, or any setting I might be missing that could help the shortcode work in this context? I appreciate any advice or solutions you could provide.
Thank you in advance for your help.
function display_album_cover_shortcode($atts) {
// Ensure we're getting the correct post ID
$atts = shortcode_atts(
array(
'post_id' => get_the_ID(),
),
$atts
);
$post_id = $atts['post_id'];
// Get the album cover field using ACF
$album_cover = get_field('album_cover', $post_id);
// If album cover is not provided or empty, return empty
if (empty($album_cover)) {
return '';
}
// Use ACF documentation approach to handle different return types
if (is_numeric($album_cover)) {
// If return type is ID, use wp_get_attachment_image
$output = '<div class="album-cover-container" style="max-width: 300px; margin: 0 auto;">';
$output .= wp_get_attachment_image($album_cover, 'full', false, ['style' => 'width: 100%; height: auto; border-radius: 4px;']);
$output .= '</div>';
} elseif (is_array($album_cover) && isset($album_cover['url'])) {
// If return type is array, get the URL from array
$output = '<div class="album-cover-container" style="max-width: 300px; margin: 0 auto;">';
$output .= '<img src="' . esc_url($album_cover['url']) . '" alt="' . esc_attr($album_cover['alt']) . '" style="width: 100%; height: auto; border-radius: 4px;">';
$output .= '</div>';
} elseif (is_string($album_cover)) {
// If return type is URL
$output = '<div class="album-cover-container" style="max-width: 300px; margin: 0 auto;">';
$output .= '<img src="' . esc_url($album_cover) . '" alt="Album Cover" style="width: 100%; height: auto; border-radius: 4px;">';
$output .= '</div>';
} else {
return '';
}
return $output;
}
add_shortcode('album_cover', 'display_album_cover_shortcode');
ps:
TagDiv documentation suggests using your built-in “Custom Field” shortcode to pull ACF data into TagDiv Composer but I also don’t want to use that because you don’t support custom fields with embeds such as YouTube or spotify (it is greyed out).
I tried to use with Custom Post Type UI and the composer.
I am trying to display custom fields (such as Artist Photo and Artist Bio) from the Artist post type when viewing a Song post. The Song post is linked to an Artist post using an ACF Post Object field.Issue:
When editing a Song post in TagDiv Composer, the custom fields from the related Artist post (e.g., Artist Photo, Artist Bio) do not display. I’ve tried multiple approaches, including:
Adding a Custom Field block in TagDiv Composer and attempting to pull the image field from the linked Artist post.
Ensuring that the Artist Photo field in the Artist post is set to return an Image URL in ACF.
Checking that the Post Object field correctly links the Song post to the Artist post.
Using both Image and Text fields in the Artist post to ensure that TagDiv can render both types of fields.
Clearing all caches and refreshing after making changes.
Steps to Reproduce:
Create a Post Object Field in the Songs post type that links to the Artist post.
In the Artist post type, create fields for Artist Photo (Image) and Artist Bio (Text).
Link a Song post to an Artist post using the Post Object field.
Open the Song post in TagDiv Composer and attempt to add a Custom Field block to display the Artist Photo and Artist Bio from the linked Artist post.
What I’ve Tried:
Inserting a Custom Field in TagDiv Composer and selecting the Artist Photo field from the related Artist post.
Verifying the return format of the fields in ACF (set to Image URL).
Using Text Blocks in TagDiv Composer to display text fields from the related Artist post, but it doesn’t work.
Clearing cache and disabling any third-party plugins that could interfere.
Expected Behavior:
I expect the Artist Photo (image) and Artist Bio (text) from the linked Artist post to display in the Song post when using TagDiv Composer.Actual Behavior:
The Custom Field block in TagDiv Composer does not display the data from the linked Artist post, even though the Post Object field is set correctly and the data is available in the Artist post.
Hi and thanks for your answer and that is terrible news because that limits what I want to do with my site. So, I switcehd to PODS and this works fantastic but tagdiv’s Newspaper theme is preventing me to apply basic things such as sorting on date.
My goal is to display custom song entries on a page and have them sorted by release date, from newest to oldest. However, I’ve encountered several issues trying to get this to work properly within the theme’s constraints.
I have a custom post type for songs, and I’m using a PODS template to output the data. I want to order the songs by release date in the template itself. However, any shortcode-based sorting or manipulation with the orderby parameter doesn’t seem to work with this theme. It appears that the theme’s Td Composer framework conflicts with typical shortcode functionality, especially for things like orderby. To avoid further issues, I’ve switched to using the “Single External Shortcode” method, but I’m still unable to apply ordering directly in the PODS template itself.
Is there a way to enforce the sorting (new to old) directly within the PODS template without relying on shortcodes? I have tried both {@post_date} and {@release_date}, but without success. Any suggestions or workarounds that you can provide would be extremely helpful, especially considering the limitations posed by the TagDiv Newspaper theme.
I’ve already enabled magic tags in shortcodes by adding define(‘PODS_SHORTCODE_ALLOW_EVALUATE_TAGS’, true); to my wp-config.php, which helped with other functionality, but this sorting issue persists.
Thanks in advance
@Bettina you said; “Unfortunately, you can only display the title and URL of the post you selected in the post object field, not other data from that post.”
What i want to achieve is when i write about a song. I pick an artist in relationship with this song so I don’t have to fill out the same info about the artist.
I tried PODS but when trying to display a list of latest custom posts the entire mobile template is looking messed up
Below is my code:
function display_custom_song_list() {
$pods = pods('tleg_song', array(
'limit' => 9,
'orderby' => 'post_date DESC',
));
if (!empty($pods) && $pods->total() > 0) {
ob_start(); // Start output buffering
echo '<div class="songs-container">';
while ($pods->fetch()) {
$song_title = $pods->field('song_title');
$album_cover = $pods->field('album_cover');
$album_cover_url = $album_cover ? pods_image_url($album_cover, 'thumbnail') : '';
$permalink = $pods->field('permalink');
$post_id = $pods->field('ID');
echo '<div class="song-item">';
if (!empty($album_cover_url)) {
echo '<div class="album-cover"></div>';
}
$genre = wp_get_post_terms($post_id, 'genre');
if (!empty($genre) && !is_wp_error($genre)) {
echo '<div class="genre-box">';
foreach ($genre as $term) {
echo '<span class="genre-tag">' . esc_html($term->name) . '</span>';
}
echo '</div>';
}
echo '' . esc_html($song_title) . '';
$related_artists = $pods->field('stage_name');
if (!empty($related_artists)) {
if (is_array($related_artists)) {
$artist = reset($related_artists);
$artist_id = is_array($artist) ? $artist['ID'] : $artist;
if ($artist_id) {
$artist_pod = pods('tleg_artist', $artist_id);
$stage_name = $artist_pod->field('stage_name') ?: get_the_title($artist_id);
echo '<div class="stage-name">' . esc_html($stage_name) . '</div>';
}
} elseif (is_string($related_artists)) {
echo '<div class="stage-name">' . esc_html($related_artists) . '</div>';
}
}
echo '</div>'; // End of song item
}
echo '</div>'; // End of songs container
ob_end_flush(); // Output the buffered content
} else {
echo 'No songs found.';
}
}
add_shortcode('display_songs', 'display_custom_song_list');
See screenshot:
https://i.ibb.co/yVgk5x7/image.png
It’s not css but PODS and how newspaper is built because always code clean and stylize later.
Hello!
This will require custom work, which is not covered by the support team.
For customization and other services, contact our custom work team here: https://tagdiv.com/premium-customization-services/.
Thank you!