Home › Forums › Front-end Issues › Grouping Results by Field on the Front-end › Reply To: Grouping Results by Field on the Front-end
Thanks for the response! I am trying the second method, I think it might be close.
I changed the “nldf_category_type” field to be a taxonomy field and created a custom taxonomy, here is the code for that.
register_taxonomy(
'nldf_category',
'nldf',
array(
'label' => 'Category',
'hierarchical' => false,
'rewrite' => array( 'slug' => 'group', 'with_front' => true, 'hierarchical' => false),
'show_in_menu' => false,
'show_ui' => false
)
);
While troubleshooting here are some things I noticed, for some reason in both loops nothing is getting echo’d out, put if I put in echo “test” it works each time through the loop. Also if var_dump($grouped_posts); I see no mention of any category. And if I echo $category I just get 33223, I am guessing those are IDs of the 2 categories?
Hmmm, I also just noticed that echo $category->name; gives me nothing.
I will keep tinkering and see what I can do, probably nothing 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.