Custom Fields Posts

Formatting a custom number field to add commas 1

Formatting a custom number field to add commas

By Pieter Hartsook / February 9, 2020 / 1 Comment
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. When displaying the number I could add a “$” in front of the number, but couldn’t find a way to format the number since you can’t do that with CSS.

Read More
Storing javascript in a metabox.io Custom Field textarea 3

Storing javascript in a metabox.io Custom Field textarea

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

For some client projects I needed to embed javascript code in a page (Post). I used a custom field textarea to insert the code when creating the Post. The problem was the default for text fields was to run them through a sanitizer.php to strip out any type of code that might be malicious. This is a good thing. But in this case it defeats the purpose. So how to disable the sanitizing for just […]

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 / 2 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
Skip to content