divider

5 User Snippets Every WordPress Developer Needs in VSCode

Services: Law Firm Website Design . SEO . Internet Marketing . Law Firm Marketing Guide . Content Marketing . PPC

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.


Related Posts

Ready to Take Your Website to the Next Level? Great Ideas & Results Only a Phone Call Away

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Let's get started.

Leave a Reply

Your email address will not be published.

*