Structure Navigation & Hierarchies

BricksMembers organizes content into hierarchical structures (e.g., Course → Module → Lesson). Use the structure navigation API to move between content items and understand relationships.

Basic Navigation

// Get next item in structure (returns WP_Post object or null)
$next_post = brm_get_next_structure_item( $post_id );
$next_id = $next_post ? $next_post->ID : null;

// Get previous item in structure (returns WP_Post object or null)
$prev_post = brm_get_previous_structure_item( $post_id );
$prev_id = $prev_post ? $prev_post->ID : null;

// Get current position
$position = brm_get_structure_current_position( $post_id );
// Returns: ['current_level' => 2, 'order_position' => 5, 'structure_id' => 'abc123']

Boundary Navigation

Navigate within specific boundaries of the structure:

// Navigate within same level
$next = brm_get_next_structure_item( $post_id, null );

// Navigate within entire structure
$next = brm_get_next_structure_item( $post_id, 'toplevel' );

// Navigate within parent scope
$next = brm_get_next_structure_item( $post_id, 'parentlevel' );

// Navigate within specific level
$next = brm_get_next_structure_item( $post_id, 'level-1' );

// Navigate within post type
$next = brm_get_next_structure_item( $post_id, 'course' );

Getting Structure Information

// Get structure data for post
$post_data = brm_core()->get_post_data( $post_id );

// Access structure path
$structure_path = $post_data->structure_path ?? null;

// Get structure levels
$levels = brm_get_structure_levels( $structure_id );

// Find structure by post type
$structure_id = brm_get_structure_id_by_object( 'course', 'post_type' );

// Get level index for post type
$level_index = brm_get_object_level_index( 'lesson', 'post_type', $structure_id );

Using in Templates

// Create navigation links
$next_post = brm_get_next_structure_item( get_the_ID() );
$prev_post = brm_get_previous_structure_item( get_the_ID() );

if ( $next_post ) {
    echo 'Next';
}

if ( $prev_post ) {
    echo 'Previous';
}

// Show position
$position = brm_get_structure_current_position( get_the_ID() );
if ( $position ) {
    echo 'Level ' . $position['current_level'] . ', Position ' . $position['order_position'];
}

Dynamic Tags in Bricks

Use dynamic tags in Bricks Builder for navigation:

// Available tags
{brm_next:url}      // URL of next post
{brm_previous:url}  // URL of previous post

// Use in link element
// Link URL: {brm_next:url}
// Link Text: Next Lesson

Best Practices

  • Use API functions: Always use brm_get_next_structure_item() etc.
  • Check for null: Functions return null when no next/previous item exists
  • Use boundaries: Use boundary parameters to control navigation scope
  • Recompute after changes: Run recompute after structure changes
Early Bird Deal

Start Building Your Membership Site Today

Create, sell, and manage your content without limits. BricksMembers gives you everything you need to build membership and LMS sites with Bricks Builder.

Lifetime updates & bug fixes • Premium support • 0% transaction fees • 60-day money-back guarantee