WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Pods, Permalinks and Page Templates (17 posts)

  1. Olly - OWMC
    Member
    Posted 1 year ago #

    I have a pod called albums. At first I had it as a Custom Post Type. I called my pod items as a list on my home page (using the code at mondaybynoon).

    Using the item name as the slug, I was able to get each item in the list to link to a page displaying the details for that item. I say details, but as a CPT it was actually only the title and main content, not any extra fields. This was because the WP template being used to display the pod item uses the standard wp "the_content();". That's as best as I remember it anyway.

    So I remade the pod as an Advanced Content Type to take advantage of Pods Pages and Templates as described on the Openscriptsolution blogpost. I created a field in the pod called permalink. Then I created an "albums" pod page, an "albums/*" pod page, an "album_detail" pod template and an "album_list" template (links to pastebin). I also set the pod Detail Page URL to "albums/{@permalink}" and the Title Field to "Name" (under Advanced Options > Pod Options).

    For the pod pages I have tried using WP page templates on both "albums" and "albums/*":
    - Pages.php
    - Pods.php

    For "albums/*", pages.php fails display the pod details, as should be expected because it uses the worpress php. But if I use pods.php (which uses "pods_content();"), I get this error:

    "Catchable fatal error: Object of class Pods could not be converted to string in /home/oliverwi/public_html/olive-and-oak/wp-content/plugins/pods/components/Pages.php(581) : eval()'d code on line 10"

    Furthermore, for "albums", pages.php fails to display the pod items, and if I use pods.php, I get nothing also.

    So I was wondering what I'm doing wrong here.

    Also, I was thinking creating an ACT and pod pages and templates seems like a lot of stuff to do, unless you require alot of control over hoe URL's are displayed. Initially I thought I'd be able to just use CPT and figure a way of displaying it using a WP page template with some amended code to call the extra fields. As CPT items seem to work like WP posts (in the admin area), I thought there should be a way to get them to work like WP pages instead, thus allowing to chose a WP template from the drop down menu when you edit it. Is this possible or something pods could potentially do in the future? It seems to me this would simplify things, at least in my current example.

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Can you post the code you used in your pod page that's generating the error? There's something wrong with your code that's not quite working. Also, paste the code from the other pod page just so I can see too.

    We're looking at adding page template support in the future, WordPress itself restricts it to only the 'page' post type, so there's not much we can do to hook or filter into that.

  3. Olly - OWMC
    Member
    Posted 1 year ago #

    Thanks Scott, thought I'd linked to all the correct page code above. They were:

    Pod page: "albums"
    Pod page: "albums/*"

    And the WP templates I tried:
    pages.php
    pods.php

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Oops, didn't realize those were links! You're clever ;)

  5. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Pod Page albums/* is echoing find(), but you need to add a call to template() there if you want to echo it the way you're wanting.

  6. Olly - OWMC
    Member
    Posted 1 year ago #

    wow how did i miss that! thanks scott, the fatal error has gone now. but i'm still not seeing anything on the page where the pod should display...

  7. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Pod Page content only works when pods_content() is called in PHP, outside of the normal WordPress loop. What's inside your 'album_list' template?

  8. Olly - OWMC
    Member
    Posted 1 year ago #

    cool, i've made sure my Pod Pages use the pods.php WP page template, which uses pods_content().

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

  9. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    OK, so it's working?

    If not, to confirm, you're using albums and albums/* pod pages set to the pods.php template, with valid templates, but no output at all?

  10. Olly - OWMC
    Member
    Posted 1 year ago #

    yup, that seems to be my issue...

    i was wondering if i should try building a new site to see if i can reproduce the error (or not). if you think i should give it a try then i'm up for it.

  11. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Send access to http://pods.io/help/ and I'll personally take a look, this may be a quick fix but I'm unable to determine if we're dealing with a bug or a theming issue.

  12. Andrew
    Forum Moderator
    Posted 1 year ago #

    Really good support Scott :)

  13. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks Andrew! I do what I can :)

    (addicted to code)

  14. Olly - OWMC
    Member
    Posted 1 year ago #

    just sent them :D

    quite agree with Andrew.

  15. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    So close! You referenced the wrong pod in your pods() code, your pod name is 'album'

    http://sc0tt.me/image/0f3w0t3D2i0a

  16. Olly - OWMC
    Member
    Posted 1 year ago #

    !!!!!!!

    You rule so many realms right now Scott! thanks again. i will be swinging by the pods donation beer fund! oh look here's the link!

    Pods is the future :)

  17. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    No problem at all!

    For what it's worth, all donations are going to a huge cause right now -- we're completely rewriting all of our documentation. The more you can beer us, the more our new doc writer can beer some fancy help text!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic