Skip Navigation

[Resolved] Display the type of file or a link to the file in View

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by olegB-2 6 years ago.

Assigned support staff: Beda.

Author
Posts
#335165

I'm creating a view in which I want to display a list of media files. I want to show there is a link for the files can be downloaded. For example, hidden link. But only available links to pages, such as hidden link. How can I achieve what I want?

#335185
Link or RAW.png

Thank you for contacting us here in the Support Forum

I understand that you want to change the URL /wp-content/uploads to a custom URL

This is a limitation of WordPress itself and not Toolset.
WordPress organizes it's URL's with the wp-prefix and the folder for Uploads, plugins, images, themes etc is wp-content

So it needs customization of the content folder, which is basically not a recommended step.

To change the URL of your File you can alternatively display a Title instead of the URL.

This you can do when you insert the Types Custom field in a Content (page, post, etc)

The wizard will ask you whether to display the raw URL or a title as a link.

See also my screenshot.

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#335195
3.png
2.png
1.png

I'm sorry that I could not properly articulate desire. Please try to understand the problem again. I need: to display a link to the file file without html tags. I want to make a link to another shortcode.

#335209

Thanks for the Details

That ShortCode is not a Toolset ShortCode.

Can you pass me the source Code for the shortCode so I can analyze it?

Also it would need the attention of the DEV of that Code, so they could fix this issue.

To display Files you can follow my previous instructions.

To use 3rd Party ShortCodes nested in Views Codes, you should first register them in
Views > Settings > Compatibility > 3rd Party ShortCodes

You currently pass the entire Post Body in your 3rd Party ShortCode (wpv-post-body)
That will produce a invalid URL as post-body is not a URL

But your 3rd party ShortCode seems to expect a URL

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#335223

"But your 3rd party ShortCode seems to expect a URL" - yes exactly.
"You currently pass the entire Post Body in your 3rd Party ShortCode (wpv-post-body)
That will produce a invalid URL as post-body is not a URL" - and as I pass URL? Which way will you advise me?

#335227

Thanks for the Details

I do not know exactly what your 3rd Party ShortCode is supposed to output, but I would (if I want to pass the File URL there) just add the shortCode mentioned by me here:
https://toolset.com/forums/topic/display-the-type-of-file-or-a-link-to-the-file-in-view/#post-335185

This would be the RAW shortCode for your Types Custom Field "File", similar to this:

[types field="file" link="true" output="raw"][/types]

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#335245

But I want to use the standard boot loader in the administrative panel. It is much more convenient than downloading files via the additional fields.

#335268

Thanks for the Details

If you do not use Types fields, I do not see how this could be solved by Toolset?

If you want to include the URL of your Image uploaded to the Media Library directly, and do not use a Types Field to display them, the only other way to display them is to enter a URL or the media directly to your Post body, or anywhere else in your content, right?

If your 3rd Party ShortCode allows you to display certain content and allows you to add a URL, you should add that URL manually, as you do not use the Types field, Toolset can not manage your URLs in any other way but as WordPress by default does.

I hope I do not fully misunderstand the issue here.

Please let me know if you have further questions regarding the issue mentioned in this Thread
and do not hesitate to open a new thread if other issues or problems arise

Thank you for your patience.

#335280

Toolset because can display of information that relates to the file: name, date, author, etc. This information is in fact not in custom fields. Is there no way to display a link? Maybe add the code in the function.php and create a new shortcode?

#335293

Thanks for the Details

You may try with the Post URL
https://toolset.com/documentation/views-shortcodes/#wpv-post-url

I see you are from Russia?

I have colleague who is also from Russia, perhaps you want to post your request in your language then I can ask my colleague to make sure I do correctly understand your query?

We have supporters from all around the world, which makes it easier to avoid Language barrier conflicts.

Please feel free to post in your Language in case you wish.

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#335302

[wpv-post-url] is not suitable, it displays a link to a page and not on file. Of course, I'll be happy to get an answer in Russian. My message to the Russian:

Приветствую! Я испытываю следующую трудность. С помощью плагина Views я пытаюсь создать представление, которое сможет вывести список загруженных медиафайлов в формате чистых ссылок на файлы. Пока что я вижу только два доступных варианта, и оба мне не подходят: если я использую шорткод [wpv-post-url] или [wpv-post-link], это выводит строку hidden link. А если использую [wpv-post-body], это выводит <a href="hidden link">Документ</a>. Мне же нужен чистый адрес, как hidden link, чтобы подставлять его для отображения в других шорткодах. Я думаю, что в принципе этого должно быть можно добиться, и надеюсь на помощь.

#335511

Greetings, I have one problem.

This is not something that you can do by default with Toolset, but to print a "nice" URL of the attached Media of a certain Post, you can use this short code:

function get_attachement_views( $atts ) {

 // Attributes
 extract( shortcode_atts(
  array(
   'type' => '',
   'post_id' => '',
  ), $atts )
 );

 // Code
$attachement = get_attached_media($type,$post_id);

if(is_array($attachement) and !empty($attachement)) {
 $str = '<ul>';
 foreach($attachement as $k=>$v):
 
   $str .= '<li>'.$v->guid.'</li>';
  
 endforeach;
 $str .= '</ul>';
}

return $str;
}
add_shortcode( 'attachement', 'get_attachement_views' );

As always register the ShortCode first in your Views Settings and then use it as this:

[attachement type="image" post_id="13"]

You can replace "image" with any attachment type:
https://codex.wordpress.org/Function_Reference/get_allowed_mime_types

You can replace "13" with [wpv-post-id]

This will print a URL like this:
hidden link

Please let me know if the above solution works for you, I look forward to your reply!

Thank you for your patience.

#335569

You mean, can be used: attachement type="image" or video/text/audio/application? The file type can not be determined automatically? What happens if it does not match? For example, you can upload the document in PDF or JPG. JPG recognized, and not recognized PDF?

#335571

Thanks for the Details

You should be able to just leave the argument "type" away, in your short code.

If you need more specific custom programming work, which is beyond the scope of our support, I would suggest you consider contacting one of our certified partners from this link:
https://toolset.com/consultant/

You will get the custom assistance you need to get on with your project.

What I can do is add your requirement as a Feature Request for Views Plugin, so our DEV can consider to add this as a default short code in future developments.

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#335610

Did you have written. Added code to the file function.php, registered a short code as Views Settings, add a short code to a view. Nothing displays.

The forum ‘Types Community Support’ is closed to new topics and replies.