Hi,
First question: Is there a way to change the shown path, after I uploaded a file with CRED (for both the creation and edit form)? At the moment it shows the full URL, which is really messy. I just want to show the file name.
Second question: With the CRED edit form I have a strange behaviour: If I already uploaded a file, then delete this file and add a new file, the old file path is shown again (see screenshot, the old path is added without link). No idea why, is this a bug?
Third question: Again only with the CRED edit form with a file already uploaded: The attribute "for" for the label gets a random string (like "3f30") instead of the id of the input field ("wpcf-beleg_file"). I even tried to add the "for" attribute in the CRED form editor, but it still gets overwritten with a random number. Is this a bug? Do you know how I can fix that?
Thanks in advance and best regards,
Michael
Hi, please create new tickets for each question. This will help you receive the most targeted answers, and will help us keep the forum organized. Thanks for understanding. I can handle the first question here.
First question: Is there a way to change the shown path, after I uploaded a file with CRED (for both the creation and edit form)?
You can add a custom shortcode that will display just the file name. Add this code to functions.php:
add_shortcode( 'my_file_name', 'my_file_name_func');
function my_file_name_func($atts)
{
$urls = $atts['file_url'];
$fileparts = explode('/', $urls);
return end($fileparts);
}
Then you can show the file name by passing the file URL into the new custom shortcode:
[my_file_name file_url="[types field='my-file' output='raw']"]