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.
This is a combo of a WordPress function added to the functions.php file that creates a shortcode that can then be used in a Beaver Builder Themer text or html module to output the raw number into a currency format.
For example you would enter 10000 into the custom field when editing the post, but when viewing the post the number now looks like $10,000.
function format_my_number($atts) {
$num = $atts["value"];return number_format($num, 0, '.', ',');
}
add_shortcode("custom-number-format", "format_my_number");
[custom-number-format value="PASS-YOUR-CUSTOM-FIELD-VALUE"]
-- So we wind up with Nested Shortcodes!
[custom-number-format value=""]
Limit search for phrases by using " " around the phrase
You will get an email the morning after we post a new Code Snippet
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.
(This post was viewed 50 times) in the last month.)
Read MoreIf 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 content to make it more interesting and easier to read and understand I’d like that formatting to be preserved even in that post’s excerpt.
(This post was viewed 390 times) in the last month.)
Read MoreRSS 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
(This post was viewed 422 times) in the last month.)
Read MoreThe client wanted to display a list of past events in a scrollable column. This was easy to implement using simple css. The page layout was done with Beaver Builder, but the solution should work for any html container.
(This post was viewed 181 times) in the last month.)
Read MoreSometimes you want to present a navigation menu as a horizontal “mega-menu” instead of a hierarchal dropdown menu. This is really simple if you are using Beaver Builder. The mega-menu feature is built in, but is unfortunately hidden. You have to know the secret to turn it on.
(This post was viewed 194 times) in the last month.)
Read More
Reader Interactions