Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Group Profiles and Post Meta Examples #14

Open
nicholaspetersen opened this issue Apr 17, 2018 · 2 comments
Open

Group Profiles and Post Meta Examples #14

nicholaspetersen opened this issue Apr 17, 2018 · 2 comments

Comments

@nicholaspetersen
Copy link

Hello! Looking for some direction more than raising an issue. I've been able to successfully loop through groups and map a couple basic meta info like images and group title, but I'm wondering if you have any examples of how to pull out the more complicated meta info for a group (day, time, childcare, location, etc) and the custom taxonomies associated with groups.

Also, I'm curious if anyone has a working example of using ccb-core to pull in a list of groups on a church website, groups finder, or something like that.

Thanks!

@jaredcobb
Copy link
Owner

Hi @nicholaspetersen!

I've been meaning to write up some additional examples in the wiki. For the fields you listed (day, time, childcare, etc) those are synchronized as custom taxonomies by default. So are you seeing those like so?

screenshot-sandbox wordpress test-2018 04 22-14-53-14

And is there data being populated (terms) when you check those? If so, you should be able to use get_the_terms() see https://developer.wordpress.org/reference/functions/get_the_terms/

For example, within your loop, if you want to output the days you would do something like:

$days = get_the_terms( get_the_ID(), 'ccb_core_group_day' );
if ( ! empty( $days ) && ! is_wp_error( $days ) ) {
	foreach ( $days as $day ) {
		echo esc_html( $day->name );
	}
}

Or maybe even use get_the_term_list() https://codex.wordpress.org/Function_Reference/get_the_term_list if you want WordPress to build all the HTML markup for you.

You can find a complete list of the default custom taxonomies that the plugin provides out of the box here https://www.wpccb.com/documentation/#groups-schema

As for using CCB Core to synchronize groups into an existing plugin's custom post types, yes, that's certainly possible. Here is a recently closed issue with some code samples (see my second example at the end of the thread) #12

@nicholaspetersen
Copy link
Author

Thank you! I think I misunderstood the docs (my fault, not yours) when I was looking for meta info instead of taxonomies. I also figured out how to output the meta info for the leader. Am I correct in understanding that the main_leader is the only one available through the api? Is there a way to pull in the assistant leaders as well?

Regarding my last question, I was actually just wondering if you knew of anyone using ccb-core in a working live environment. I'm working on my own, but would love to see anyone else who's done something with it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants