garyK-5
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Adding a Numeric Monitary Value of a Filter
Started by: garyK-5
in: Toolset Professional Support
Problem: How to filter the addition of numeric values in a search Solution: Make sure that you put the sum of the numeric values after the view. Sample code to get started on how to create a shortcode for that: /** * Register shortcode to add field values for each item in loop to give total (after loop) */ add_shortcode('sum-item', function ($atts=[],$content = null) { $atts = shortcode_atts( array( 'total' => null ), $atts ); static $running = 0; $output = ""; if ( ! is_null( $content ) ) { $content = do_shortcode( ltrim($content) ); if ( is_numeric( $content ) ) { $running += $content; } } if ( ! is_null( $atts['total'] ) ) { $output = $running; } return $output; }); How to use the shortcode: /** An example of usage in the output of a View: */ [wpv-items-found] [wpv-post-link] [sum-item] [types field="number-field"][/types][/sum-item] [sum-item total=true] [/wpv-items-found] |
|
2 | 7 | 2 years, 10 months ago | |
format as money calculated function on Views
Started by: garyK-5
in: Toolset Professional Support
Problem: The issue here is that the user wanted to convert the output of they're code to currency format. Instead of the function returning 1000 they wanted $1,000.00 Solution: This can be done by wrapping your final output from your code with the number_format() function. Here is a quick sample below. $num = 1000; //value to be passed return "$".number_format($num, 2, '.', ','); // The above will change the format to $1,000.00 For more details on the number_format() function you can check the php documentation. |
|
2 | 8 | 3 years, 1 month ago | |
Content Template being used on all unique post types
Started by: garyK-5 in: Toolset Professional Support |
|
2 | 5 | 3 years, 2 months ago | |
Styling Search and Reset Button
Started by: garyK-5 in: Toolset Professional Support |
|
2 | 10 | 3 years, 6 months ago |