Support

Account

Forum Replies Created

  • I finally accomplished this by doing the following:

    <?php
    if( $posts ):
        foreach( $posts as $post): // variable must be called $post (IMPORTANT)
            setup_postdata($post);
            $seriesID = get_the_ID();
        endforeach;
        wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly
    endif; 
    $sermons = new WP_Query(array(
        'post_type' => 'sermon',
        'meta_query' => array(
            array(
                'key'     => 'series',
                'value'   => $seriesID,
                'compare' => 'LIKE'
            )
        ),
        'order'	=> 'DESC'
    ));
    ?>

    I’d love to know if there’s a better way, though!

  • Well that is unfortunate. If I were to use the custom post types, I would have to start from the ground up with my site and a different theme, builder, etc. So unfortunately that isn’t an option. Thanks for attempting to help me though!

  • From what I can tell, I want to use custom taxonomies over custom post types. I also use Divi as my theme, and the custom post types break that. Taxonomies can be added to my already made pages though (I use pages not posts for everything). Now my problem is extracting the custom fields from a page that is added to a term (I believe that is correct) in my custom taxonomy.

    Better explanation: I created (using Custom Post Type UI) a custom taxonomy for “speaker”. I went to the speakers individual pages and put in a new term for their name (1). I added a taxonomy ACF field type to my “Sermons” ACF group (2). In my post for a sermon, I select the speaker I want from the select dropdown. Now how do I use all that to call the ACF field “speaker_name” from that speakers page?

  • Here is another image to hopefully help clear the mud some more.

  • James, thanks for the reply. Let me see if I can get some screenshots to explain this.

    Three groups: Sermons, Series, and Speaker; Sermons has a “relationship” to series and speakers. Instead of having to manually enter every Series and Speaker, I want a sermons post to be able to pull options from posts inside Speakers and Series. For example, I am posting a sermons that is part of the “Restart” series (has it’s own page and filled out a group form for the group Series) and the speaker for that sermon is Pastor Wayne Surface (also has its own page under the group Speakers). Is there any way for my form for Sermons to look for all the posts under speakers and see “Oh, there’s a post for Pastor Wayne Surface, let’s put that as an option to choose for this sermon” and then at the series input for the sermon, “Oh, there’s a series post for ‘Restart’, let’s put that as an option for the series field.”

    I really hope this makes more sense! Haha…

  • Yes it does! It’s all working correctly now, so I’m glad I got it worked out. It was one of those problems where I knew that would happen in the back of my head, it just didn’t click. Thanks for your help!

  • Well this helped me solve the problem by thinking about it. Basically what was happening is this: I have two separate ACF groups; sermons and series. Every sermon falls into a series, so I had “series_title” as a field name in the sermons field group. In the series field group, I also had “series_title” because, obviously, the series needs a title. I wasn’t thinking about how my code pulled from every group, anything that had “series_title”, so that top row was the entry for the series “Restart”, and thus had none of the other fields filled out because that entry didn’t have those fields at all. Does that make sense? I fixed it by changed the sermons field group to have “series_name” for the field instead of “series_title”.

Viewing 7 posts - 1 through 7 (of 7 total)