• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Twitter GitHub
You are here: Home / Archives for Programming

Programming

Promise and Async / Await

Last updated on August 7, 2020 by Sal Ferrarello

Making fetch calls with Promises vs async/await.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Draft, Programming Tagged With: JavaScript, JS async / await, JS Promise

Enable, Read, and Write Post Meta in WordPress Gutenberg

Last updated on January 13, 2021 by Sal Ferrarello

The WordPress block editor (a.k.a. Gutenberg) communicates with the database via the WordPress REST API. We can read and write post meta from within the Gutenberg editor after we enable the specific post meta field in the WordPress REST API.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming Tagged With: Gutenberg, WordPress, WordPress Post Meta

Join Strings with Commas and “And” in JavaScript

Last updated on July 16, 2020 by Sal Ferrarello

In English the rules we use for joining a list of items involves more work than a standard join in JavaScript. Here is JavaScript code to join an array of elements with commas and an “and”.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: JavaScript

Add WordPress Posts Column

Last updated on July 2, 2020 by Sal Ferrarello

Code to add a custom column to the WP Admin Posts listing page.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Draft, Programming, Solution Tagged With: WordPress, WordPress Filter

Why __() needs a hardcoded string in WordPress

Last updated on June 18, 2020 by Sal Ferrarello

When using a WordPress translation function, e.g. __(), you need to use a hardcoded string (not a variable).

Filed Under: Dev Tips, Programming, Recommendations Tagged With: Internationalization (I18n), WordPress

JavaScript get Date in YYYYMMDD Format

Last updated on June 15, 2020 by Sal Ferrarello

Recently, I was working in JavaScript and I need to transform a date into the format YYYYMMDD, this is how I did it.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Dev Tips, Draft, Programming, Solution Tagged With: DateTime, JavaScript

Code Standards Naming Styles

Last updated on June 11, 2020 by Sal Ferrarello

There are lots of ways to write variable names when programming. This is the list of ones I find myself using.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Dev Tips, Draft, Programming Tagged With: code standards

Add Gutenberg JavaScript Filter

Last updated on May 18, 2020 by Sal Ferrarello

WordPress PHP filters allow you make a value modifiable from outside of your code. With the WordPress Block Editor (a.k.a. Gutenberg), you can now do the same thing in JavaScript.

Filed Under: Dev Tips, Programming, Solution Tagged With: Gutenberg, JavaScript, WordPress, WordPress Filter

Check WP_DEBUG

Last updated on April 19, 2020 by Sal Ferrarello

Recently I was talking to another developer about how to detect ‘WP_DEBUG’ being set on a WordPress installation. Here is the code I use.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: WordPress, WordPress Plugin

WordPress Gutenberg import versus Destructuring Global wp

Last updated on April 24, 2020 by Sal Ferrarello

When creating a block for the WordPress block editor (a.k.a. Gutenberg), you are often using existing components. WordPress makes these components available under the global JavaScript variable ‘wp’ as well as available as npm packages. Which is the better way to make a component available in your code?

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Draft, Programming Tagged With: Gutenberg, JavaScript, WordPress

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 15
  • Next Page»

Copyright © 2021 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in