Skip Navigation

[Resolved] Numerical operations

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by rajivG 3 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#2126579

Hi,

I have a query, please.

I have [wpv-found-count] showing the number of listings.

Just next to it, I want a column that will do this calculation:
[wpv-found-count] X 7, i.e., the count multiplied by 7

Would you please advise how to get this done?

Thanks,

Rajiv

#2126813

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Rajiv,

Thank you for getting in touch.

Will this be a case where the [wpv-found-count] will always be multiplied by 7?

Please let me know so that we can know how to best proceed.

Thanks,
Shane

#2126819

Yes.

The [wpv-found-count] will always be multiplied by 7, suffixed with 'questions'.

My final output will be, for example, 140 questions, 210 questions, 14,000 questions, 7,000 questions, etc.

#2126899

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Rajiv,

You should now be able to use this shortcode that I just created.

// Add Shortcode
function wp_multiply_seven( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'val' => '',
		),
		$atts
	);

	return $atts['val']*7;

}
add_shortcode( 'wp_multiply_seven', 'wp_multiply_seven' );

Add it to the Toolset custom code section at Toolset -> Settings -> Custom Code then activate it once you've saved it.

To trigger the shortcode you will need to do it like this.
[wp_multiply_seven val='[wpv-found-count]']

This should return the found count multiplied by 7.

Thanks,
Shane

#2127421

It works beautifully. Thank you so much, Shane. Appreciated !