Pods 2.0: How to Display Pods Item using Pods Page and Pods Template

Yesterday I received an email contains the announcement from Scott Kingsley Clark; the lead developer of Pods Framework plugin about the plan of Pods 2.0 release today on my local time September 22, 2012. Yeah, it’s been a long time waiting for Pods 2.0, and today it was really here! So excited, eh?

After trying to play with it, then here’s step by step how to display Pods Item using Pods Page and Pods Template using the new method. This is the simplest example to give you the idea how it works as well as Pods 1.x. Actually, there are some big differences between Pods 1.x. So, I suggest you to install Pods 2.0 on your computer in localhost instead of on the production server in order to play with it.

In the following example, I will show you how to add a new Pods content; which has its own table; named countries. Of course, you can enhance it so it will suit with your needs.

Activate Pods and Setup New Pods

  1. First of all, download Pods 2.0 plugin by clicking here, extract it to your /wp-content/plugins/ sub-folder of your WordPress installation, and then activate it.
  2. From your WordPress Admin menu, go to Pods Admin -> Setup.
  3. You will see an Add New Pods page, and you are in the first step: 1. Create or Extend. Just choose/click on the Create New option.
  4. From the Content Type directive, choose Advanced Content Type (separate from WP, blank slate, in its own table). Updated: Please note that since Pods 2.3, Advanced Content Types have been split off into their own component which you can enable to be able to add new Advanced Content Types.
  5. In the Plural Label, type: Countries.
  6. Click on the Advanced + link, and make sure in the Identifier directive is not blank. The value should be countries.
  7. In Singular Label, type: Country, and then click on Next button on the right bottom of the page.
  8. Now you should see an Edit Pod: countries page appears. You will see there are five fields have been created by Pods by default. They are: Name, Date Created, Date Modified, Author, and Permalink. Now we will add a new field named Country ID. Follow the next step below.
  9. Click on the Add Field button, and then in Basic tab, click on Label directive, and type: Country ID
  10. Press Tab button in your computer keyboard, then in the Name directive should be filled in with the value of country_id. Make sure this directive is not blank, otherwise you cannot procede to the next step.
  11. In the Options directive, make sure you have given the checked marks at Required and Unique items, and leave the others at this moment, then click on Add Field button.
  12. Now we will configure another settings in order to make this Countries Pod is displayed in your WordPress Admin menu. Click on the Advanced Options link in the below of Manage Fields section, and then in the Label tab, make sure in the Label directive has been filled in with Countries and in the Singular Label directive has been already filled in with Country.
  13. Click on the Pod Options tab, and in the Detail Page URL directive, type: countries/{@permalink}, give checked mark at the Show in Menu item, and then in the Title Field, make sure has been selected with Name.
  14. Click on the Save Pod button in the top right of the page in order to save the changes to your database, and make sure you have already seen a new menu appears below the Comments; named Countries.

Add New Records

  1. Hover your mouse to the Countries menu in WordPress Admin menu, and then click on Add New sub-menu.
  2. Now let’s add some new records, and in this example, will add seven records.
    They are:
    – Indonesia (Name: Indonesia, Permalink: indonesia, Country ID: id),
    – Australia (Name: Australia, Permalink: australia, Country ID: au),
    – United States of America (Name: United States of America, Permalink: united-states-of-america, Country ID: us),
    – Singapore (Name: Singapore, Permalink: singapore, Country ID: sg),
    – Germany (Name: Germany, Permalink: germany, Country ID: de),
    – Italy (Name: Italy, Permalink: italy, Country ID: it), and
    – Canada (Name: Canada, Permalink: canada, Country ID: ca).
  3. Check the records, by clicking on All under Countries menu in the sidebar of WordPress Admin.

Activate and Setup: Pods Template and Pods Pages

  1. In Pods 2.0, Pods Page and Pods Template are located under Pods Admin -> Components sub-menu. Click on the sub-menu, and then activate Templates and Pages components.
  2. Go to Pods Admin -> Templates, and then click on Add New button at the top of page.
  3. Now you should see an Add New Pod Template page appears. Let’s create a Pods Template for displaying the detail of Pods Item. To do this, enter the template name: country_detail, and copy the following code to the Content directive:

    <div>Country Name: {@name}</div>
    <div>Country ID: <strong>{@country_id}</strong></div>
    <div>Permalink: <strong>{@permalink}</strong></div>

    and then click on Publish button at the right side of page.

  4. Let’s add the Pods Template for displaying the list of Pods item. To do this, click again on Add New button, and then enter the template name: country_list, and copy the following code to the Content directive:

    <p><a href="{@detail_url}">{@name}</a></p>

    and then click on Publish button at the right side of page.

  5. Go to Pods Admin -> Pages, and then click on Add New button.
  6. You will see an Add New Pod Page page appears. Now we will add a new Pods Page that contains the list of the Pods items and this page is related to its URL structure. In addition, we will also add the pagination to this List page. To do this, at the first textbox, enter the URL: countries, and in Page Title directive, type: Countries List, and then in the Content directive, type the following code:

    // Get 3 records per page, ordered by name ascending,
    $params = array( 'orderby' => 'name ASC', 'limit' => 3 );
    // Maps to the new find method
    $pod_countries = pods( 'countries', $params );
    // Display it to the template
    echo $pod_countries->find( $params )->template( 'country_list' );
    // Display the pagination
    echo $pod_countries->pagination();

    afterwards, click on the Publish button.

  7. Now we will add a new Pods Page for displaying the detail of Pods item, and it is related to its URL structure. To do this click again on Add New button, and then enter the URL: countries/*, and in Page Title, type: Country Detail, and then and copy the following code to the Content directive:

    // Get the latest variable from Pods URL
    $id = pods_url_variable('last');
    // Define the params to find the Pods Item based on the $id
    $params = array( 'where' => 'permalink = "'.$id.'"' );
    // Display it by using Pods Template
    echo pods( 'countries' )->find( $params )->template( 'country_detail' );

    afterwards, click on Publish button at the right side of page.

Check the Results!

  1. That’s all. Now let’s have a look the result. Type in the URL of your browser the address (assume my WordPress localhost installation is: http://localhost/wppods/), so it will look like this: http://localhost/wppods/countries/. You should see the list of the three records of the countries appear in the page:

    1 2 3 Next › Last » 

    whereas each of them has the link to its detail Pods item. As you can see, the pagination will be displayed also at the bottom of that page. You can navigate to the next or previous page.

  2. Click on one of the records (for example: Australia), then in the next page you will see the detail of the country which has the URL http://localhost/wppods/countries/australia.
    The page will show you the content just like this:

    Country Name: Australia
    Country ID: au
    Permalink: australia


  1. Aaron says

    Hi, im very new to WordPress, but used other CMS’s, just having a play around with it for work and wanted to get my heard around customizing content. To keep things short, I followed the tutorial twice but was getting page not founds when trying to view “http://localhost/testwpsite/countries/”

    Running windows/EasyPHP/Wordpress 3.4.2 and Pods
    I have tried it on a vanilla install, is there anything else I have to do, or should try?


    • says

      Go to your WordPress Admin Panel (wp-admin) -> Settings -> Permalinks, and then make sure you have chosen Day and name option, and then click on Save Changes button. Also make sure rewrite_module is enabled in your Apache server.

      • Aaron says

        Brilliant Thanks! That worked, I had to rebuild the pod pages after I change the permalink setting, but I think I could have cleared a cache or something to get around it.


  2. Sarah says

    First off, thanks so much for explaining Pods here with this real-life example. It really helped me what to choose Pods and start learning how to use it.

    Referring to #7 in your post above, how could I find the Pods Item based on more than one value? I have a puppies Pod and would like to show only the males that are not sold (for search reasons).


    $params = array( 'where' => 'permalink = "'.$id.'"' ); 

    I’m successfully using:

    $params = array( 'where' => 'gender = true' ); 

    (true is male, false is female)

    I would also like to add:

    'where' => 'available = true' ); 

    (true is available, false is sold)

    I tried this without success:

    $params = array( 'where' => 'gender = true' && 'available = true' );

    How to do it?

    • Sarah says

      Ahh, I figured it out – too many quotation marks:

      $params = array( 'where' => 'gender = true && available = true' );

      Thanks anyway!

  3. Mike says

    For step #6, under “Activate and Setup: Pods Template and Pods Pages”, I believe that the

    ->find( $params )

    part of your code is redundant.

    According to this documentation, the find function is automatically run when an array is provided as the second argument to the pods() function call.

    Please correct me if I’m wrong.

    Thanks for the great tutorial!

    • says

      Hi Mike,

      You are right. However, I was including $params in order for consistency in writing code; either for displaying list of Pods item (countries/) or displaying detail of Pods item (countries/*).

      As you can see, if you implement the same technique for “countries/*” Pods page, it will not work. In addition, I referred to Differences between 1.x and 2.0 when I was playing with it.

      Here is the quote of code I copied from that article regarding it:

      // NEW! Get the pod object, find data, output each item using the template
      echo pods( 'mypod' )->find( $params )->template( 'template/name' );
  4. Mike says

    Sorry, I wish I could edit my previous comment to add this. Just for clarity’s sake.. so instead of:

    // Display it to the template
    echo $pod_countries->find( $params )->template( 'country_list' );

    you should be able to have

    // Display it to the template
    echo $pod_countries->template( 'country_list' );
    • says

      Roger that. Both of them are working properly only for list of Pods item, but not for detail of Pods item.

      As I mentioned in my previous reply to you, I prefer always including $params for consistency in writing code; either for displaying list of Pods item (countries/) or displaying detail of Pods item (countries/*), since your suggestion code will not work for detail of Pods item.

      • Mike says

        Thanks for your reply Masino. Can you help me understand why that same shortened code doesn’t work for displaying the detail of Pods items? I’m not quite wrapping my head around it.

        • Mike says

          I actually just tested it and it does work as expected. Here is the code I’m using. Please let me know if you get the same functionality:

          Pod Page: countries

          // Get 3 records per page, ordered by name ascending,
          $params = array( 'orderby' => 'name ASC', 'limit' => 3 );
          // Maps to the new find method
          $pod_countries = pods( 'countries', $params );
          // Display it to the template
          echo $pod_countries->template( 'country_list' );
          // Display the pagination
          echo $pod_countries->pagination();

          Pod Page: countries/*

          // Get the latest variable from Pods URL
          $id = pods_url_variable('last');
          // Define the params to find the Pods Item based on the $id
          $params = array( 'where' => 'permalink = "'.$id.'"' );
          // Display it by using Pods Template
          echo pods( 'countries', $params )->template( 'country_detail' );

          By the way, what tags does your comment form support if I want to mark a code block as such?

          Thanks again!

  5. says

    Thanks for great post. Now I trying to solve this problem. I am making the iPad Application catalog. I successfully defined new pod and template. Then I wrote new WP Page Template with php code for listing of the applications (pods). Each pod have set of the check boxes (YES/NO) for making taxonomy. But how can I filter the pods? For example the apps for grammar school, apps for primary education etc.
    In pods() function is parametr where, but there is not any taxonomy atribute in wp_post table. Many thanks for help.

  6. Bill Hatch says

    Great Article, thanks.
    I fail to show pagination. The function returns a blank string. It appears to happen in the function do_hook which is part of the pagination return value. Is there some parameter I am missing. I see the list of 3 test records but the pagination line is missing.

    I would appreciate any suggestions.

  7. Simon says

    I’m getting a database error on the Country Detail page saying:
    Response: Unknown column ‘permalink’ in ‘where clause’

    The issue being caused by this line of code in the countries/* page:

    // Define the params to find the Pods Item based on the $id
    $params = array( 'where' => 'permalink = "'.$id.'"' );

    Any ideas on what the issue is?

  8. Chris says

    When I follow these steps, in steps 6 and 7, I don’t have textareas labelled “Content” — I only have “Page Code” and “Page Precode”

    If I put the output in “Page Code,” nothing appears on my pages.

    If I put the output in “Page Precode,” the output appears (as expected) before the tag.

    Do I need to add something to a .php file like page.php to get my content to appear?

    • Chris says

      Blech, the content wasn’t appearing because I actually still had an old, incorrect pods.php file in my themes folder from an earlier attempt. Deleted this file and content appears as expected.

      Just as a heads-up though, there is no “Content” textarea, just one called “Page Code”

  9. says

    I’m having real difficulty getting the pods pages to work. I managed to display a template in my page.php manually, but going to ‘/countries’ or to ‘/countries/australia’ will show either:
    A page with no content – if I’ve not not selected a page template in the pods page admin.
    Or the following error:
    Notice: Use WP Page Templates or hook into the pods_content filter instead of using Pod Page PHP code has been deprecated since Pods version 2.1.0 with no alternative available. in C:\Websites\xxxxxx\httpdocs\wp-content\plugins\pods\functions.php on line 260
    If I’ve selected ‘Page’ as my page template.

    I’m running pods 2.2 – can you help?

  10. Peter Kidd says

    This paginates the list of pod records over however many pages are required based on the limit (per page). How do you Paginate the pod records themselves, as in either ‘side’ of Canada, Previous or Next being Australia or Germany respectively in this example?

  11. pentool says

    Under “Activate Pods and Setup New Pods” step 13 says to type in a value into the “Detail Page URL” field. using Pods v2.3.1 I don’t see such a field. How would I go about setting this up in this version? Thanks.

  12. Chris says

    This tutorial seems outdated or at least not compatible with the current version of Pods. Would be great to see an update for the same.

    Thank you,

  13. says

    This is awesome, but I have a really long list of countries in a .CSV file… how do I add that data so I can put them into the correct fields?

  14. Jaymes says

    “13. Click on the Pod Options tab, and in the Detail Page URL directive, type: countries/{@permalink}, give checked mark at the Show in Menu item, and then in the Title Field, make sure has been selected with Name.”

    Where is this option at?? I don’t see it anywhere.

  15. Kevin says

    I am looking for assistance also. I have followed t instructions to a T using advanced content types, and see nothing when I preview the page.

    Any suggestions?

  16. Koli14 says

    When i copy your code into my Pod Template, and Publish it, the code changes, and all the new-lines turning into ‘rn’.
    Also when i write anything in the content, the same is happening.
    I would be happy if you would update your tutorial, cause in pod 2.3 it is a bit different, than in your tuto.

  17. Sergi says


    I am using Pods 2.0, and I am trying to get the URL of a uploded file from Pods 2.0. Anyone know how to get that URL on the WP query?


  18. francis says

    I too have followed step by step the procedure (as far I can could – the layout of the admin pages has changed quite a bit) and I get an empty page at the end.
    Is there a way of debugging or getting an idea of what’s happening (or not?). Up to now to me it’s a bit like a black box.

  19. Hercules Iorw says

    In setting up the template code, how do I display a pod field item as a hyperlink in the template content.
    I want to set up a download link {@download}


  20. ramon says

    hi, I followed the tutorial, but when putting siteurl / countries, finds the page but without any content
    I used the plugin version 2.3.9
    thank you very much

    • Gary Gordon says

      Yes. Same thing here. I’m using the newest version of PODS and WP 3.8. Not seeing any content when I go to the countries page. But .. if I remove the php code on the countries page and just put the word TEST .. this shows up. Not sure why (with the newest version of Pods .. the PHP isn’t displaying using this exact code. Any idea why? Any help available?


  21. twowarm says

    I created a custom post type ‘movies.’ I created a custom taxonomy, ‘actors,’ to associate multiple actors with each movie.

    How do I display all the actors for each movie?

  22. Ruanna says


    How would I change the limit of how many Pods items are displayed using a Pods Template? I have 16 records and understand that default limit is 15 – I need to override that. I found info on how to fix the shortcode but not the template. Please and thanks!

    • andrew says


      I’m also need to know how to manage the limit?
      I’m building a database of Indonesian comic artists and there are hundreds of them.
      How can I use pagination?

      can I contact you directly?

      Many thanks!

  23. Gez says

    This is referenced from the main PODS documentation as the way to ‘do templates and pages’? Really? But it refers to things that don’t exist in the current version and it DOESN’T WORK. Like everybody else here: blank page/

    • DG Blackwell says

      You would be correct. The current state of documentation on how to use the Pods plugin on the internet, including references from the Pods official site itself, is littered with TOO many out of date irrelevant Tuts by too many “publish once for glory and go get about it” psuedo-experts; just like everything else WordPress related – a conglomerate of untidy reference to a psuedo-CMS that is out of control.

  24. Al says


    I need a help about relation fields. How can I show list of values from checkout box from relation field and their links? I know how to show the list but between every value I have “and” and I can’t show the links for each value. For example: Cat and Dog, and I need to display Cat, Dog, also for each of them separate link.. Cat, Dog



  1. […] Pods Templates – This is one place where you would start to add in the HTML structure for the stuff you want to display on your site. Pods Templates uses “magic tags” instead of traditional php. So for instance, if you wanted to display the contents of the field called “name” you would simply type {@name}. This is the super fast, super easy way to get pods data up and running. Here is a great tutorial for making pods templates and displaying them. […]

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>