pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

How do I sort a field in a Pod Template? #2868

Closed gsocha closed 6 years ago

gsocha commented 9 years ago

I am using a Pod Template to show data from multiple Pods. The main Pod contains information about organizations. One of the related Pods contains information about press releases. I want to set up the Pod Template so that for each organization, all related press releases are displayed, from newest to oldest. I have been able to set up the Pod Template to show the related press releases. I have not been able to figure out how to show them from newest to oldest. I have not been able to find any guidance in the support forum.

How might I do that, using the Pod Template? Thanks.

I am using Pods version 2.5.1.2 and WordPress 4.2

Here is the page showing what happens with the template: http://www.edrm.net/archives/organization/content-analyst-company

Here is the current template:

Type {@org_type}
Website {@org_url}
Year Founded {@year_founded}

[if related_release]

Press Releases

[each related_release][/each]
{@related_release.release_date} {@related_release.post_title}

[/if]

Shelob9 commented 9 years ago

You can't sort a relationship field using Pods Templates. If this is a requirement for you, then you shouldn't use Pods Templates. If you were accessing the field via the Pods class, this would be doable with the find() method.

gsocha commented 9 years ago

Thanks. Where should I go to learn more about this?

George J. Socha, Jr., Esq. Socha Consulting LLC

1374 Lincoln Avenue, St. Paul, MN 55105 office: +1 651 690 1739 | mobile: +1 651 336 3940 | fax: +1 651 846 5920 george@sochaconsulting.com Socha Consulting: www.sochaconsulting.com EDRM: www.edrm.net Apersee: www.apersee.com Mailing list: subscribe for news, requests & more

On Apr 27, 2015, at 11:42 AM, Josh Pollock notifications@github.com wrote:

You can't sort a relationship field using Pods Templates. If this is a requirement for you, then you shouldn't use Pods Templates. If you were accessing the field via the Pods class, this would be doable with the find() method.

— Reply to this email directly or view it on GitHub.

jimtrue commented 9 years ago

Howdy George, you're going to have to get into PHP WordPress Theme Templates if you want ONE template to show all the different items and be sorted in a specific way. You can check out our documentation on the find() function (which includes our Video PodsCast on using the Find function which includes orderby:

http://pods.io/docs/code/find/

If you're not as familiar with WordPress Theme Templates, check out the latter two PodsCasts which describe how to get your Pods Data into the theme using PHP function calls (WordPress functions in the first one and Pods functions in the 2nd):

http://pods.io/2015/04/03/podscast-003-displaying-data-in-pods-pt-1/ http://pods.io/2015/04/16/podscast-004-displaying-data-pt2/

gsocha commented 9 years ago

Thanks, Jim. I have looked at some of the podcasts but I will go back and watch these more carefully.

For what it is worth, it seems to me that one ought to be able to sort a relationship field using a pod template - and a pity that one can’t. Maybe that can go a future features list?

George J. Socha, Jr., Esq. Socha Consulting LLC

Informing digital discovery decisions

1374 Lincoln Avenue, St. Paul, MN 55105 office: +1 651 690 1739 | mobile: +1 651 336 3940 | fax: +1 651 846 5920 george@sochaconsulting.com mailto:george@sochaconsulting.com | http://www.sochaconsulting.com http://www.sochaconsulting.com/

EDRM: http://www.edrm.net http://www.edrm.net/ | subscribe for news http://www.edrm.net/wp-login.php?action=register | unsubscribe mailto:mail@edrm.com?subject=Pleasee%20Unsubscribe%20Me%20From%20EDRM Apersee: http://www.apersee.com http://www.apersee.com/ | subscribe for news, requests & more https://www.apersee.com/pages/subscribe | unsubscribe http://apersee.cmail2.com/t/j-u-zuykry-hihujhkk-y/

On Apr 27, 2015, at 12:22 PM, Jim True notifications@github.com wrote:

Howdy George, you're going to have to get into PHP WordPress Theme Templates if you want ONE template to show all the different items and be sorted in a specific way. You can check out our documentation on the find() function (which includes our Video PodsCast on using the Find function which includes orderby:

http://pods.io/docs/code/find/ http://pods.io/docs/code/find/ If you're not as familiar with WordPress Theme Templates, check out the latter two PodsCasts which describe how to get your Pods Data into the theme using PHP function calls (WordPress functions in the first one and Pods functions in the 2nd):

http://pods.io/2015/04/03/podscast-003-displaying-data-in-pods-pt-1/ http://pods.io/2015/04/03/podscast-003-displaying-data-in-pods-pt-1/ http://pods.io/2015/04/16/podscast-004-displaying-data-pt2/ http://pods.io/2015/04/16/podscast-004-displaying-data-pt2/ — Reply to this email directly or view it on GitHub https://github.com/pods-framework/pods/issues/2868#issuecomment-96786921.