Hi There, Hope you're well and wishing you a happy 2024.
I'm using ACF to create a custom post type and have added a field for a file upload that returns the URL of the uploaded file.
I'm creating a table that uses the custom post type but when I create a column for the upload data field it isn't simply adding the link that should be returned.
Please can you advise on how I can achieve this using WP Data Tables.
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
First when it comes to ACF, since we don't have native a built-in integration with a plugin such as ACF, pulling data from that plugin into wpDataTables would have to be done with custom MySQL query-based tables.
Please note: Using this plugin feature requires at least a basic knowledge of SQL.
It is assumed that you can create the table in some MySQL data manager (e.g., PHPMyAdmin, MySQL Workbench), and prepare a SQL query that will return the data you need. If you do not know how to use MySQL, refer to the “Create a MySQL-query-based table by generating a query to MySQL database” section.
It will explain how to create complete tables or MySQL queries without this basic knowledge.
Please be advised that preparing MySQL queries for you is not included in the plugin support.
If i understood, you already got that part working in terms of pulling the data you need in a Custom SQL Query Table, and the issue of the upload file functionality seems to be the current subject.
1. Can you tell me, which Column Type are you choosing for this Field in our Plugin's SQL Table, is it set to be an URL Link Column, or perhaps an Image Column?
If you set the Column to an URL Link Column, then our Plugin makes the data in the cell will automatically wrapped inside HTML anchor/link Tags, such as :
<a href="https://www.Link To your File">Hyperlink displayed text</a>
Or if you set it as Image Column, then our Plugin wraps everything inside the HTML img/image tag like :
The only way to have a cell only store the URL of a file is to use a String Column type in our Table;
But then you will not be able to use an Editor input Type as Attachment, that is the current limitation, sadly.
So, if you need a cell to only store a link and nothing else/avoid our Plugin having it wrapped inside a HTML anchor tag or image tag, currently the only way is to use a String ( one-line or multi-line) type Column in our Plugin and to make the table Editable as "One Line" or "Multi Line" editor, then to have a user input the link to a file manually;
Then the String Column will only save the link in the cell and nothing else, if that makes sense.
At the moment, it is the only way - but if you have an idea what we might improve for the future, you can leave a development suggestion.
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
-
If you have coding skills and wish to try to make a custom solution now,
Hi There, Hope you're well and wishing you a happy 2024.
I'm using ACF to create a custom post type and have added a field for a file upload that returns the URL of the uploaded file.
I'm creating a table that uses the custom post type but when I create a column for the upload data field it isn't simply adding the link that should be returned.
Please can you advise on how I can achieve this using WP Data Tables.
Hi Keegan,
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
First when it comes to ACF, since we don't have native a built-in integration with a plugin such as ACF, pulling data from that plugin into wpDataTables would have to be done with custom MySQL query-based tables.
Please note: Using this plugin feature requires at least a basic knowledge of SQL.
It is assumed that you can create the table in some MySQL data manager (e.g., PHPMyAdmin, MySQL Workbench), and prepare a SQL query that will return the data you need. If you do not know how to use MySQL, refer to the “Create a MySQL-query-based table by generating a query to MySQL database” section.
It will explain how to create complete tables or MySQL queries without this basic knowledge.
Please be advised that preparing MySQL queries for you is not included in the plugin support.
If i understood, you already got that part working in terms of pulling the data you need in a Custom SQL Query Table, and the issue of the upload file functionality seems to be the current subject.
1. Can you tell me, which Column Type are you choosing for this Field in our Plugin's SQL Table, is it set to be an URL Link Column, or perhaps an Image Column?
If you set the Column to an URL Link Column, then our Plugin makes the data in the cell will automatically wrapped inside HTML anchor/link Tags, such as :
Or if you set it as Image Column, then our Plugin wraps everything inside the HTML img/image tag like :
The only way to have a cell only store the URL of a file is to use a String Column type in our Table;
But then you will not be able to use an Editor input Type as Attachment, that is the current limitation, sadly.
So, if you need a cell to only store a link and nothing else/avoid our Plugin having it wrapped inside a HTML anchor tag or image tag, currently the only way is to use a String ( one-line or multi-line) type Column in our Plugin and to make the table Editable as "One Line" or "Multi Line" editor, then to have a user input the link to a file manually;
Then the String Column will only save the link in the cell and nothing else, if that makes sense.
At the moment, it is the only way - but if you have an idea what we might improve for the future, you can leave a development suggestion.
Please feel free to search on our suggestions page,
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
-
If you have coding skills and wish to try to make a custom solution now,
you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.
Please be advised that custom solutions with hooks are not included in our support.
You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.
( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables