• Resolved gusreibernsd

    (@gusreibernsd)


    Using the Pods admin GUI:
    Pods Admin -> Edit Pods -> Course-> More Fields -> Units -> Edit Field -> Relationships Options

    I set the “Customized ORDER_BY” field to be “menu_order”, expecting the “[each unit]” tag in the “course” template to be ordered by the “menu_order”.

    What am I not understanding about how the “ORDER_BY” setting is supposed to work?
    Template code is shown here:

    {@post_content}
    [each units]
    <h4>

    <a class="unit">Unit {@menu_order}</a>
    {@post_title}
    </h4>

    {@post_content}
    [/each]
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support pdclark

    (@pdclark)

    I’m not sure whether the orderby option on a relationship field would effect [each] or not… it might only apply to output of magic tags, like {@units}, which can be filtered to custom output with functions named after a comma. See “Passing values through callbacks and filters” on https://docs.pods.io/displaying-pods/magic-tags/

    Another consideration is whether “menu_order” is the correct field: menu_order is a WordPress core column in the wp_posts table… it is very rarely used, except with the Page post type and some plugins which extend it with drag-and-drop interfaces. It’s only editable when Page Attributes is enabled on the post type.

    It might be the case that the intended ordering is according to the “menu” of the Pods relationship field. That’s enabled in the Field Options under Advanced by setting the relationship type to Multi-Select List, then allowing reordering.

    When that ordering interface is used, I would expect the related items to be output in the list order by default, without changing orderby.

    Thread Starter gusreibernsd

    (@gusreibernsd)

    @pdclark Thank you very much for the detailed reply! It seems you are correct that [each] cannot be ordered in the Pod Templates. 🙁
    But… the drag-n-drop ordering does drive the [each] order, which is sort of OK, but in this case, I want my workflow to maintain the unit chapters with the unit, but I’ll live.

    It looks like I can activate full short-code handling in my Pod Templates with the following code in my wp-config.php? :

    define(‘PODS_SHORTCODE_ALLOW_SUB_SHORTCODES’, true);

    …and then I can put a pods shortcode into a pods template?
    At some point I should probably just model my own data in PHP.

    Thank you again for your help, @pdclark

    Plugin Support pdclark

    (@pdclark)

    Yes, shortcodes can go in shortcodes with that configuration.

    Also note that menu_order is a WordPress core data having to do with the Page post type, on wp_posts table. It is not the same as orderable Pods fields, which store the order as a serialized PHP array in a single wp_postmeta entry.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sorting Linked types with the template view’ is closed to new replies.