Support » Plugin: Pods - Custom Content Types and Fields » Custom page template for CPT, and to list children

  • Resolved kidino


    Here’s is what I am attempting. Honestly I use Elementor Pro to design the page template for the custom post type. I have the following CPT:

    – Courses
    – Modules (Videos)

    _one Course has 1 or many Modules_

    In Modules, I created a field with relationship that identifies which Course it belongs to. So I created a page template for Courses. And I want to be able to list the Modules for the Course.

    I have been trying out the Pods – List Items widget. There is a WHERE option, but I can only put in static value. Is there away where the template identifies which Course ID it is presenting to the browser, and the List Items widget knows which ID it needs to filter for?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Scott Kingsley Clark


    Sorry, this isn’t quite possible. Your best bet may be to create your own widget or use PHP code to build out the results you want.

    Our widgets support data based off of the current post ID like: my_field = {@post_id}

    Thanks for the response. So I went ahead and created a custom plugin for my site. And I created a shortcode like in the code below.

    Just sharing if others might want something similar. Then I use it when creating the template for Course CPT using Elementor, with the shortcode widget.

    function myofa_course_modules(){
    if (get_post_type() != ‘pod_course’) {

    $course_id = get_the_ID();

    $params = array(
    ‘where’ => “link_course.ID = $course_id”

    $mypod = pods( ‘pod_module’, $params );

    echo “<ul class=’pod-modules-list’>”;
    while ( $mypod->fetch() ) {
    $module_url = get_permalink( $mypod->display(‘ID’) );
    echo “<li>”;
    echo “<a href=’$module_url’>”.$mypod->display(‘post_title’).”</a>”;
    $cover = $mypod->field(‘cover’);
    echo wp_get_attachment_image( $cover[‘ID’] );
    echo “</li>”;
    echo “</ul>”;
    add_shortcode(‘myofa_course_modules’, ‘myofa_course_modules’);

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.