PHP Posts

Formatting a custom number field to add commas 1

Formatting a custom number field to add commas

By Pieter Hartsook / February 9, 2020 / 0 Comments
Posted in , , , ,

I needed to format a number field (999,999,999), coming from a custom field number-format (no other characters permitted in the number entry field). No “$” no commas or decimal points, etc. to output as a normal currency format.

Formatting a custom number field to add commas 2

When displaying the number

Read More
How to add custom post types to your default RSS feed 3

How to add custom post types to your default RSS feed

By Pieter Hartsook / March 27, 2020 / 0 Comments
Posted in , , ,

RSS readers are somewhat old school in 2020, but the RSS feed that is part of WordPress is used by email services like Mailchimp and Mailerlite to create automated email updates when you add a new post to your website.

If you have custom post types though, they are not included in the default URL:

https://yoursite.com/feed

Read More
A bit of PHP to preserve html formatting in standard WordPress excerpts 4

A bit of PHP to preserve html formatting in standard WordPress excerpts

By Pieter Hartsook / March 30, 2020 / 0 Comments
Posted in , , ,

If you don’t use the Excerpt field in your posts and rely on WordPress to grab the first few dozen words of your post content what you usually find is the excerpt when displayed on the front end (usually in some sort of archive or post grid display) will have most of the html tags removed leaving you with a single block of plain text.

If I go to the bother of formatting my post

Read More
Simple History plugin banner

Shorten the length of the log file for Simple History plugin

By Pieter Hartsook / July 21, 2020 / 0 Comments
Posted in , ,

The Simple History plugin default history period is 60 days. The log includes not only user initiated changes to the website, but all the automated updates to plugins, etc. This can make the log file pretty large.

Read More