WordPress different templates for same type custom post (but different slug)

I have created one custom post type lets say movie, now I have created 4 posts under movie type.

Slugs are movie/parasite/director and movie/parasite/actor. Similarly movie/joker/director and movie/joker/actor. Now I want to load two types of template one for director and other for actor based on slug.

I'm using pod plugin for custom post type.

What I'm doing I have created one single php file name single-movie.php file under theme folder. This single-movie.php file template file is loading for all movie post type but I want to load different template based on movie post type slug. Any help appreciated.

Topic pods-framework slug custom-post-types Wordpress

Category Web


In this case, since there's a many-to-many relationship between movies and actors, I recommend making them two separate pods with a relationship between them. See the intro video at https://pods.io/ ... I don't remember where he explains relationship fields but it's all in there.

You don't need to use PHP if you don't want to. You could use Pods templates (see the video). Something like this for movies (it's a tweak of one of mine). It assumes you've filled in the title and content for both movies and actors:

    <div>
      [if related_actors]
        <h4 style="font-weight:bold; font-size:x-large;">Actors:</h4>
        <div style="padding-left:4em;">
          [each related_actors]
            <h3>
              [if post_thumbnail_url]
                <img src="{@post_thumbnail_url.small}" style="float:left; width:150px; height:auto; padding-right: 15px;">
              [/if]
              {@post_title}
            </h3>
            <div style="clear:both;">{@post_content}</div>
          [/each]
        </div>
      [/if]
    </div>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.