Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Shortcodes on Archive Page not rendering #5371

thomasavvion opened this issue May 8, 2019 · 2 comments


None yet
2 participants
Copy link

commented May 8, 2019

Issue Overview

Custom shortcodes that work fine on pages / post types and inside pods templates - are not rendered on the archive page.

Expected Behavior

I have defined custom shortcodes in my functions.php that render the pods field labels in the frontend.

I want to use these custom shortcodes not only in pods templates and inside custom post types, but also on my customized archive.php.

Current Behavior

Points 1-4 below illustrate what I have done and what the results are

  1. Here is the code for the shortcodes in my functions.php:


  • Pods Shortcode
    function pods_get_field_label($atts) {
    //if($ct === false || $label === false)

$tmp = explode('_', $atts['field']);
$ct = false;
if(is_array($tmp)) {
$ct = $tmp[1];

$ct = pods('post_type_' . $ct);

return $ct->fields( $atts['field'], 'label' );
add_shortcode( 'get_field_label', 'pods_get_field_label' );


  • Image Sizes in List
    function pods_get_image($atts) {
    $mypod = pods( 'post_type_project', $atts['pods_id'] );
    $mypod_image = $mypod->field('field_project_image_teaser');
    $rand_size = array('project-teaser-large', 'project-teaser-small');
    $rand_num = rand(0,1);
    $size = wp_get_attachment_image_src($mypod_image['ID'], $rand_size[$rand_num]);

//return '

return '
add_shortcode( 'get_pods_image', 'pods_get_image' );`

  1. Here is the pods template "template_post_type_project_list" that uses the shortcodes:

<a href="{@permalink,esc_url}" class="custom-template project-list-item {@taxonomy_project_category}"> [if field_project_image_teaser][get_pods_image pods_id="{@ID}"][/if] <div class="project-list-text"> [if field_project_name]<div class="field-project-name">{@field_project_name}</div>[/if] [if taxonomy_project_series]<div class="taxonomy-project-series">[get_field_label field="taxonomy_project_series"]: {@taxonomy_project_series}</div>[/if] [if field_project_client]<div class="field-project-client">[get_field_label field="field_project_client"]: {@field_project_client}</div>[/if] [if taxonomy_project_category]<div class="taxonomy-project-category">[get_field_label field="taxonomy_project_category"]: {@taxonomy_project_category}</div>[/if] [if field_project_date]<div class="field-project-date">[get_field_label field="field_project_date"]: {@field_project_date}</div>[/if] [if field_project_description]<div class="field-project-description">{@field}{@field_project_description}</div>[/if] </div> </a>

  1. Integrating this pods list on any page or post type inside the wysiwyg area renders perfectly in the frontend, the custom shortcodes from 1) are rendered as expected:

[pods name="post_type_project" template="template_post_type_project_list"]

  1. However, integrating the pods list in my custom archive.php like so:

<?php echo pods($post->post_type,$post->ID)->template('template_'.$post->post_type.'_list'); ?>

.... renders the custom shortcodes from 1) in plain text in the front end, ie [get_field_label field="field_project_client"] etc. Note: The content itself is rendered correctly.

Steps to Reproduce (for bugs)

Simply reproduce steps 1-4 above.

WordPress Environment

Debug Information
WordPress Version: 5.1.1

PHP Version: 5.6.40-0+deb8u1

MySQL Version: 5.5.62

Server Software: Apache

Your User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36

Session Save Path: /var/lib/php5/sessions

Session Save Path Exists: Yes

Session Save Path Writeable: Yes

Session Max Lifetime: 1440

Opcode Cache:

Apc: No
Memcached: No
OPcache: Yes
Redis: No
Object Cache:

APCu: No
Memcache: No
Memcached: No
Redis: No
WPDB Prefix: wp_

WP Multisite Mode: No

WP Memory Limit: 40M

Current Memory Usage: 44,343M

Current Memory Usage (real): 45,500M

Pods Network-Wide Activated: No

Pods Install Location: /var/www/batou/binnerKatrin/www/dev/binka_www_wp/wp-content/plugins/pods/

Pods Tableless Mode Activated: No

Pods Light Mode Activated: No

Currently Active Theme: BergerSchmidt

Currently Active Plugins:

Pods - Custom Content Types and Fields: 2.7.12
Search & Filter: 1.2.11


This comment has been minimized.

Copy link

commented May 8, 2019

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

@thomasavvion thomasavvion changed the title Custom Shortcodes on Archive Page Custom Shortcodes on Archive Page not rendering May 8, 2019


This comment has been minimized.

Copy link

commented Jun 5, 2019

Hello @thomasavvion,

I believe Pods()->template(); doesn't apply shortcodes automatically.
Please try wrapping your template call in the do_shortcode() function from WP like so:

echo do_shortcode(
    pods( $post->post_type, $post->ID )->template( 'template_' . $post->post_type . '_list' )

More info:

Let me know if this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.