5 User Snippets Every WordPress® Developer Needs in VSCode

Close-up of a computer screen displaying HTML and JavaScript code in an integrated development environment (IDE). Colored syntax highlighting is evident in the code lines, showcasing the latest new algorithm updates for better speed.

User snippets are an essential part of the daily workflow for most developers using VSCode.  For the unfamiliar, user snippets allow developers to write large amounts of code in one short word. VSCode uses JSON files for each programming language to manage any shortcuts that the developer wants to use. This can be accessed through VSCode by going to File > Preferences > User Snippets. For the snippets below, they can be added to the html.json file. Make sure to add the snippets within the parent {} bracket.

WordPress® Query

This snippet is the most useful snippet for WordPress® developers. Developers often need to write queries to get various pages or custom post types. The below snippet generates a full query with the loop with one simple word, query. The arguments can be changed for the query to meet whatever needs the developer requires. Bill Erickson’s WP Query page has a full list of arguments with notes on what everything does.

ACF Repeater

This snippet creates a repeater loop for any repeater custom fields accessible on the page. However, this only applies to sites that have Advanced Custom Fields Pro on their site.

WordPress® Content

The snippet below allows you to quickly add the title and content of the post.

Include Template

You’ll often find that you will need to create include files for code that is commonly used in various templates. To add those files into templates, you can use the “includeTemplate” prefix to quickly add them.

Page Id Conditional

This final snippet allows you to quickly create a conditional check to see if the current page ID is equal to a number.

Share This
Blog Decorative Background

Join the Sales and Marketing News, receive our last insights, tips and best practices.

Our 7 Guarantees

Keeping 2,000+ Clients Happy Since 2001.

1
You Will Love Your Design We design to please you and your clients
2
Same-Day Support 24-hour turnaround edits during business hours
3
Free Education We provide knowledge to help you expand
4
No Hidden Charges We quote flat-rate projects
5
Own Your Site No strings attached
6
We Create Results SEO, PPC, content + design = clients
7
We Make Life Easier One agency for web, branding and marketing