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

WordPress Filter

WordPress Filter Early Return Pattern

Last updated on August 31, 2021 by Sal Ferrarello

A common programming pattern when using WordPress filters is the early return pattern (also know as the “short-circuit” pattern). This pattern is useful when you want to allow a filter to override a value that is “expensive” to calculate.

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

Filed Under: Computing, Dev Tips, Draft, Programming Tagged With: WordPress, WordPress Filter

WordPress Hooks and PHP Namespaces

Last updated on July 22, 2021 by Sal Ferrarello

While PHP namespaces allow you to refer to a function in file without using the fully qualified name, there is a catch when adding a WordPress hook or filter. The PHP __NAMESPACE__ magic constant can be helpful in this situation.

Filed Under: Dev Tips, Programming, Recommendations Tagged With: PHP, WordPress, WordPress Filter

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

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

How to Add a Twitter Hashtag with Scriptless Social Sharing

Last updated on April 24, 2019 by Sal Ferrarello

When using Scriptless Social Sharing, you may want to add a site wide hashtag to all of your tweets. This is the code you can use to do that.

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

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

Override WordPress Publish Date on Creation

Last updated on November 5, 2018 by Sal Ferrarello

When creating new posts for a video demonstration, I wanted to display a consistent date. While my first thought was to reset my system clock, this snippet overrides the date when the post is first created, which worked for me.

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

Filed Under: Dev Tips, Draft, Presentation Tagged With: WordPress, WordPress Filter

Remove target _blank from the Scriptless Social Sharing Email button

Last updated on August 27, 2018 by Sal Ferrarello

I like to use the Scriptless Social Sharing WordPress plugin to add Share buttons to my blog posts. Recently I had a client notice that because the Email Share button has target=”_blank” in the HTML markup, it opens a new tab when clicked. This is great behavior if you’re using web based email (e.g. Gmail), however if you’re using an email application on your computer, you end up with a blank tab. This code removes target blank from the email share link.

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

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

Featured Image Label for WordPress

Last updated on August 13, 2018 by Sal Ferrarello

I often find it helpful to add a label to the Featured Image area in the WordPress admin. By guiding clients to upload the appropriate sized image, it lets me avoid them being surprised by WordPress cropping their image in an unexpected way.

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

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

UTM Parameters.

UTM parameters with Scriptless Social Sharing

Last updated on July 8, 2018 by Sal Ferrarello

When it comes to adding social sharing buttons (e.g. “Share on Facebook”), I’m a big fan of Scriptless Social Sharing by Robin Cornett. The one thing I like to do when using it is add UTM parameters to the links that are shared. Here is the snippet I use to add UTM parameters to my URLs that are being shared.

Filed Under: Dev Tips, marketing, Programming, Solution Tagged With: seo, WordPress Filter

Building block car with extra pieces nearby

Make Your WordPress Plugin Easy to Extend

Last updated on October 14, 2017 by Sal Ferrarello

As a WordPress developer it is a painful (and all too familiar) feeling of angst, when I find a plugin that does almost exactly what I want but the author has left no way for me to modify the behavior without changing their code. Don’t Hack Core (or plugins) A popular refrain in WordPress developer […]

Filed Under: Dev Tips, Programming Tagged With: Templates, WordPress Filter, WordPress Plugin

  • Go to page 1
  • Go to page 2
  • Next Page»

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