Eliot Akira on "[Plugin: Custom Content Shortcode] Counting pages/posts"

ساخت وبلاگ

Eliot, thank you. I'm just getting back into using CCS for a new project, so I'm a bit rusty. Could you help me a little more. Let's say I want to create a loop that lists all the child pages of the current page, ideally while matching a custom field as well. In my last project I used posts, so I could use categories and tags, but since this one is using pages, I need to match to a custom field.

The basic architecture of my encyclopedia is that there are topic pages and resource pages. Topic pages list all child topic pages (child topics would be states/provinces if they exist), and then list all the child resource pages in up to about 5 sections (set by custom field).

So when I load a country page, which is a topic, let's say for the United States, I need to show that there are 50 child pages for each state (child pages that match the type 'topic' and the area 'province'), then within each section (History, Contemporary, etc.) it shows the child pages of type 'resource' that also match the corresponding section (History, etc.).

Each time I show a child topic (i.e. a state/province) I want to show how many resources are listed in that topic (i.e. how many child pages of type 'resource' there are). Each time I show a resource on a topic page, I want to show how many Idea there are on that page.

For example, it might look something like:

United States

Regions:
Alabama (20) Colorado (60)
Alaska (54) Connecticut (45)
Arizona (34) Delaware (34)
Arkansas (65) Florida (66)
Califoia (145) Georgia (34) ....

History
Source Name Comments
Wikipedia History of the United States 5

Books
Source Name Comments
OUP Oxford History of the US 6

So in the above example, it shows all the provinces at the top (I put 10, but you get the idea) and shows how many resources are listed on each province page (i.e. 20 child pages of page Alabama of the type 'resource'). There are then two categories that have resources for the United States page itself, History and Books. Under each category I show one resource, with the info all grabbed from custom fields for the resource page (except the number of Idea - can I access that through CSC?). For each resource, the name would link to the actual resource (a URL grabbed from a custom field from the resource page) and the comment number would link to the resource page itself which could display all the custom fields (for the book maybe the cover photo, the publisher, author etc.) and would allow users to comment on the resource using standard WordPress Idea.

Sorry for all that detail. If you can point me in the right direction I'd be very grateful.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 123 تاريخ : چهارشنبه 22 ارديبهشت 1395 ساعت: 4:55