Adding variable to get_template_part
It looks like you’re just trying to concatenate a string, so it can be done like this: <?php get_template_part( ‘template-parts/component-page/component-‘ . $variable ); ?> Or you could use string interpolation (note the double quotes used here): <?php get_template_part( “template-parts/component-page/component-{$variable}” ); ?> Alternatively, get_template_part() can take two parameters, $slug and $name: <?php get_template_part( ‘template-parts/component-page/component’, $variable ); … Read more