Support

Account

Home Forums General Issues Loop through post content from another post Reply To: Loop through post content from another post

  • Alright, well I’m running roots / sage which shouldn’t make much difference.

    I have a template for the “Project” posts which looks like this:

    {{--
      Template Name: Projekt
    --}}
    
    @extends('layouts.app')
    
    @section('content')
      @while(have_posts()) @php the_post() @endphp
        @include('partials.content-projekt')
      @endwhile
    @endsection
    

    And then I have content-single-projekt page which takes care of the flexible content and it looks like this:

    @include('partials/section-hero')
    
    @include('partials/section-intro')
    
    <?php if( have_rows('content') ): ?>
    	<?php while( have_rows('content') ): the_row(); ?>
        
    		<?php if( get_row_layout() == 'projectfacts' ): ?>
    			<h1>stuff here</h1>
    
    		<?php elseif( get_row_layout() == 'apartmentlayout' ): ?>
    			@include('partials/section-apartment')
    
    		<?php endif; ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    And lastly my section-apartment looks like the example up top.