Skip Navigation

[Resolved] Planning my custom posts

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#613587

I'm looking for help in structuring the following project.

I am creating a Voter database that will be used in political campaigns for outreach and canvassing. I have a list of voters with associated data including voting history for the last 8 elections.

I've started with creating a Voters custom post type with associated custom fields (CF) and taxonomies (Tax):

Voters: Each voter has a set of information attached to them like voter ID#(CF), Name(CF), Date of Birth(CF), sex(Tax), contact information like address and phone number (CF), congressional district(Tax), voting precinct (Tax) registered political party (Tax) etc.

I have managed to import about 10,000 voters into this CPT using WP All Import Pro.

My next task is where I am looking for guidance.

I want to Import the Voters History. This list has their Voter ID number as the common key, and also which of the last 8 elections the voter participated in, this includes the date, the election title and the method of voting (mail ballot or in person.)

This data needs to be filterable so we can filter voters based on their history, which is important in identifying likely voters.

My question should "elections" be a child custom post type or a Taxonomy? I'm leaning towards taxonomy but then not sure how to implement the method of voting variation? Or maybe there is a more logical way to do this that I have not considered?

#613595

Dear Mike,

I assume we are talking about this:
one "Voters" can connect to multiple "Elections"
one "Elections" can connect to multiple "Voters"

In your case, I suggest you try to setup "Elections" as a post type, and setup many-to-many relationships between post type "Voters" and "Elections", see our document:
Implementing many-to-many relationships
https://toolset.com/documentation/beyond-the-basics/post-relationship-concepts/implementing-many-to-many-relationships/

#613598

Yes it appears it would be a many to many relationship so I will give that tutorial a try.

While I am setting this up I have two questions:

Will I be able to import my Elections and associate them with the "Voter" CPT? I do have the Voter ID in the history file and also have this in the Voter CPT already.

Will I be able to filter my list based on the Election?

#613612

Q1) Will I be able to import my Elections and associate them with the "Voter" CPT?
Types plugin is using a custom field "_wpcf_belongs_[parent-slug]_id" to store the parent post ID, for example:
Parent post type "Voter", post type slug "voter" + parent post type "Elections"
- Child post type "voting"

When you import the "voting" posts, in each "voting" post, you will need to setup a custom field "_wpcf_belongs_voting_id", field value is the "Voter" post ID.

Q2) Will I be able to filter my list based on the Election?
Yes, it is possible to setup a view to query the child post "voting", and filter by parent posts, see our document:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/#displaying-child-posts-using-views
section "Displaying child posts using Views"

The forum ‘Types Community Support’ is closed to new topics and replies.