Support » Plugin: Simple Custom Post Order » Ordering for custom posts in a custom gutenberg block

  • Resolved Bananenbiegerei



    I am using the following setup:
    • a custom gutenberg block created with acf fields and registered in the function.php
    • the block uses a select field to filter for a custom post type
    • I want to display the selected post type ordered by Simple Custom Post Order
    • The Backend just works fine
    • But the frontend doesn’t show the order

    Here is the code for the loop in the gutenberg block:

    $field = get_field_object( ‘post_type_loop’ );
    $value = $field[‘value’];
    $label = $field[‘choices’][ $value ];
    $column_count = get_field(‘column_count’);
    <section id=”<?php echo esc_attr( $id ); ?>” class=”<?php echo esc_attr( $classes ); ?>”>
    <div class=”grid-x grid-margin-x small-up-1 medium-up-<?php echo $column_count; ?> block-grid padding-top-1 padding-bottom-2″>
    $args = array(
    ‘post_type’ => array($value),
    ‘orderby’ => ‘menu_order’
    $query = new WP_Query( $args );
    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    <div class=”cell”>
    if( get_field(‘display_options’) == ‘Simple’ ) {
    if( get_field(‘display_options’) == ‘Card’ ) {
    <?php }
    } else {

    Here is a screenshot from the frontend:

    And that is the backend:

    I already tried to add ‘orderby’ parameter. But this doesn’t help.
    Thanks in advance

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.