Hello and thank you for contacting Toolset support.
1)
As I understand you want to list three different type of media in different columns but it should remain same in single column while its looping in views.
1) I attached a sketch of what i'm trying to do (it would be 3 columns, so maybe it would be better to make 3 differetnt views, one for each format Images/pdf/audio-video)
I tried a WPV-if but i think i didnt syntaxed it propperly.
How should i check if post_mime_type is an image or pdf?
1)
I think you should use some custom shortcode which will return you the string based on the post_mime_type and then you should check the returned string that returned based on the "post_mime_type".
add_shortcode('get_mime_type',get_mime_type_for_attachment);
function get_mime_type_for_attachment($id) {
$type = get_post_mime_type($id);
switch ($type) {
case 'application/pdf':
return 'PDF';
break;
case 'image/jpeg':
case 'image/png':
case 'image/gif':
return 'IMAGE';
break;
case 'video/mpeg':
case 'video/mp4':
case 'video/quicktime':
return 'AUDIO';
break;
case 'text/csv':
case 'text/plain':
case 'text/xml':
return 'TEXT';
break;
}
}
But here I would like to know the structure that with which post type you are dealing with, is this attachment?
2)
In order to be of better help, it will be great if you provide me test install where I can see your data structure, views, post_types etc..etc and I will help you further with shortcode.
*** Please take FULL BACKUP of your database and your website.***
In order to investigate your issue if we require to check things on your install in order to see what could be going wrong there.
If you agree to this please use the form fields I have enabled below this comment box to provide temporary access details (wp-admin and FTP)?
I have set next reply as private.
Das Thema „[Geschlossen] View showing a site attachments list filtered by post_mime_type?“ ist für neue Antworten geschlossen.