147 posts
  • Czech Republic
  • Has been a member for 2-3 years
Itachicz says

Hi everyone,

I have this piece of chode

<?php
if ( has_post_format( 'quote' )) { ?>

    <?php get_template_part('includes/post-formats/quote-format.php'); ?>

<?php
} else if (has_post_format('gallery')) { ?>

    <?php get_template_part('includes/post-formats/gallery', 'format'); ?>

<?php
} else if (has_post_format('video')) {
   // stuff to display the link format post here
} else { ?>

    <?php get_template_part('includes/post-formats/clasic', 'format'); ?>

<?php } ?>

and in each particular template part I’m using $item_width variable. Does anyone know how to pass this variable through these functions?

Thank you very much for all advices and suggestions :)

1397 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

There is no way, either have your variables globally accessible, or use this instead:

include( locate_template( 'template-part.php' ) );
147 posts
  • Czech Republic
  • Has been a member for 2-3 years
Itachicz says

There is no way, either have your variables globally accessible, or use this instead:
include( locate_template( 'template-part.php' ) );

Thank you very much for your reply :)

by
by
by
by
by
by