• 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

Create WordPress Child Theme

Last updated on November 1, 2019 by Sal Ferrarello

You can quickly create a WordPress child theme by creating a new theme directory and adding two files: style.css and functions.php.

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

Filed Under: Draft, Programming Tagged With: WordPress, WordPress Theme

PHP declare(strict_types=1);

Last updated on October 23, 2019 by Sal Ferrarello

What does declare(strict_types=1); do in PHP? PHP is a weakly typed language, which means that when a value is of the wrong type, PHP tries to cast it to the proper type. For example if you try to add an integer and a string, echo 5 + “3”; PHP will try to cast the string […]

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

Filed Under: Computing, Draft, Programming Tagged With: PHP

phpcs display sniff name

Last updated on October 25, 2019 by Sal Ferrarello

By default phpcs does NOT display the relevant name of the sniff when a sniff fails. By adding the ‘-s’ argument, the sniff names will be displayed. See the following from ‘phpcs –help’. Alternatively, this can be added to your PHP CodeSniffer XML Ruleset.

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

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: PHP, PHPCS

Speed Up Video in Iframe

Last updated on September 6, 2019 by Sal Ferrarello

My wife has to watch some videos as part of an online course. These videos do not have speed controls, however she would like to watch the video at an increased rate (e.g. 1.5x the normal speed). The problem is the video appears in an iframe (which is in itself in an iframe) so targeting the video to change the speed with JavaScript is a little tricky. Here is how I did it.

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

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

setUp() must be compatible with PHPUnit\Framework\TestCase::setUp

Last updated on August 26, 2019 by Sal Ferrarello

When setting up a new site using PHPUnit 8.x and PHP 7.2, I got the error message: setUp() must be compatible with PHPUnit\Framework\TestCase::setUp Because we can now define the method as returning no value (with :void) and this is part of the method definition starting in PHPUnit 8.0.0, we need to add this in our […]

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

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: PHP, PHPUnit

Modern Tribe Events Calendar Replace Default Event Link with Event Website

Last updated on August 23, 2019 by Sal Ferrarello

When using the WordPress plugin [The Events Calendar](https://theeventscalendar.com/) by Modern Tribe the default link in the calendar will point to the Event page. However, sometimes we want to point this link to the Event Website value (which we can set when creating the event). This is the code I use to do this.

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

Filed Under: Draft, Programming, Solution Tagged With: The Events Calendar, WordPress Plugin

Getting Started with CSS and WordPress

Last updated on August 13, 2019 by Sal Ferrarello

A great place to get started with web coding is CSS. CSS tells the web browser how to display the information on the page, for example the color, size, or font to use. WordPress makes it particularly easy to add your own CSS to your website.

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

Filed Under: Dev Tips, Draft, Programming Tagged With: Customizer, WordPress

The difference between __() and _x() in WordPress

Last updated on May 30, 2019 by Sal Ferrarello

WordPress has two similar translation functions __() and _x(). The function _x() does the same thing as the function __() except the _x() function allows you to define a context for the translation (with the $context parameter). This is helpful when you have a string that could be two different words. For example there are two words that are spelled “tear” each with a separate meaning (and separate pronunciation). By including the context you could use both of these words and have them correctly translated based on their $context value.

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

Filed Under: Draft, Programming Tagged With: WordPress

HubSpot API call fail INVALID_DATE not midnight!

Last updated on May 21, 2019 by Sal Ferrarello

When making a HubSpot API call to update a date picker field, I’m getting a response with “response code 400”, “error INVALID_DATE”, and the message includes “not midnight!”. This is why I’m getting this error and how I fixed this call.

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

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

WordPress Database Prefix

Last updated on April 29, 2019 by Sal Ferrarello

By default all of the WordPress database tables will start with the prefix “wp_” (e.g. wp_users, wp_posts, etc.). Because this is the default value, you’ll often hear the tables referred to (and written about) using the “wp_” prefix. Let’s look at how and why this prefix is modified.

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

Filed Under: Dev Tips, Draft, Programming Tagged With: database, WordPress

  • «Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Interim pages omitted …
  • Go to page 15
  • Next Page»

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