Skip Navigation

[Resolved] Sportspress plugin

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to explode the custom field value

Solution:
You can use the custom shortcode to explode the custom field value.

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/sportspress-plugin/#post-652078

Relevant Documentation:

This support ticket is created 6 years, 9 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by christopheV-2 6 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#651851

I use the sportspress plugin.
To get the result of a match I put in views this shortcode: [wpv-post-field name = 'sp_results']

And I get: 2, win, 0, loss
I would like in this information to have only 2 - 0

How can I proceed?

Thank you

#652078

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you need to use custom shortcode where you should pass the field value. [wpv-post-field name = 'sp_results']

For example - Please add following code to your current theme's functions.php file:

function func_display_sp_results( $atts ) {
	
	 $a = shortcode_atts( array(
        'field' => '',
       ), $atts );
	   
	 $val = explode(",",$a['field']);
         $val = $val[0]." - ".$val[2];
            return $val;
	   
    
}
add_shortcode( 'display_sp_results', 'func_display_sp_results' );

And use the shortcode as:

[display_sp_results field="[wpv-post-field name = 'sp_results']"] 
#652181

It's perfect.

Big thanks