Skip Navigation

[Resolved] How can I add prefix to the field output?

This support ticket is created 2 years, 11 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)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 2 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#2042011

How can I add prefix to the field output?

#2042221

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Can you please share bit more information what prefix you would like to add.

Toolset offers the hook wpv-post-field-{name} that you may try to use:
=> https://toolset.com/documentation/programmer-reference/views-filte=> rs/#wpv-post-field-name

#2043595

Your link is not working.

#2044229

Minesh
Supporter

Languages: English (English )

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

Sorry - here is the correct link:
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv-post-field-name

If you do not know how to use that filter, please share what field you what to have prefix with what value and where you want to display it on what page/post.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2051367

Hello,

Can you please explain what filter should I use for my issue and what parameters should I pass. I am a PHP programmer.

Thank you.

#2051405

Minesh
Supporter

Languages: English (English )

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

I've added the following filter to "Custom Code" Section offered by Toolset: wpcf_fields_slug_{$field_slug}_value_display
=> hidden link

add_filter( 'wpcf_fields_slug_int_affiliate_url_value_display', 'prefix_wrap_customfield_field', 99, 5 );
 function prefix_wrap_customfield_field($meta, $config, $post_ID, $field_ID, $meta_id ) {
    $meta = "go/".$meta;
    return $meta;
}

To run a test, I've added the Types shortcode to the following post body:
=> hidden link

And when I display the post on frtonend, I can see it dded the "go/" text before the field value:
=> hidden link

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.