Best way to get get_post_format() on a blade template

I’m working in a blog that uses 3 post formats, but i’m stuck trying to figure out how to get the post format that uses to redirect the view to the right template. is there an easy way to do this?

thanks in advance

  @while (have_posts()) @php(the_post())
    @include ('partials.content-'.(get_post_type() !== 'post' ? get_post_type() : get_post_format()))
  @endwhile
2 Likes

in single.blade i’ve added

@section('content')
    @while(have_posts()) @php(the_post())
        <div class="grid-container">
          <div class="grid-x grid-margin-x">
            <div class="small-12 cell">
              @include ('partials.content-single-'.(get_post_type() !== 'post' ? get_post_type() : get_post_format()))
            </div>
          </div>
        </div>
    @endwhile
@endsection

that way i can have full control on single posts

thank you @ben

1 Like