Posts tagged 'templates'
Variable scope in WordPress template parts
I was building a custom WordPress theme for a client site when I came across a frustrating problem with variable scope. I was modularising the theme using template parts, which get loaded using the get_template_part function. This particular template was displaying a list of posts of a custom post_type from a call to the get_posts function and I wanted to be able …