Tag: code snippets
-

Creating a Custom Post Type
Custom post types are a fantastic tool for anyone who uses WordPress. For a site owner, they allow you organize different types of content. This extends to customizing the way you present that content to the user. For a developer, they’re a great way to test your projects. Working on saving some metadata to the…
-

How To Refactor Your Components with React’s useState
The useState hook in React can help you refactor your code into a more concise, legible, and maintainable form. It also makes it easier to interact with APIs.
-

Focusing the End of an HTML Text or Search Input
Make life easier for users filling out forms by including this javascript snippet to auto-focus the end of the text input the user was most recently working on.
-

Treat Javascript Objects like Arrays with Object.keys()
Arrays and Objects are the two most commonly used data structures in JavaScript. Object.keys helps bring them together.
-

Add a Custom Field to Each New Post in WordPress
In one recent project, I wanted to allow users more control over the blog and taxonomy pages of a WordPress theme by letting them select from two possible layouts for each post in the index. But how should users actually choose between them?