Support

Account

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 🙂