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()))

in single.blade i’ve added

    @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()))

that way i can have full control on single posts

thank you @ben

1 Like