Woocommerce - Custom folder per product upload based on ID/SKU - wordpress

What would be the best method to manage product images so that each product has its own folder in the uploads directory based on either its post id or sku?
Attempted a few different methods via wp all import but feel I need to think outside of the box.

Related

Upload files from fontend into WP categories

i have searched a lot, not comming up with a solution, i want to allows department users in organization to be able to upload files from frontend in Wordpress, they should be able to upload into there category, like i have created Legal Post category, so legal guys should upload only to legal category,
any plugin or file manager for wp
thanks
we have hook 'edit_category_form_fields' for add extra field in the post category. which will help you for set upload field for upload file. Once it field is create then we have to set permission for this field to able to add from front-end. Please check this link how to use hook the help you. https://developer.wordpress.org/reference/hooks/edit_category_form_fields/

Can Advanced Custom Fields be built into a custom wordpress theme i.e. fields can be determined immediately when a user installs the theme?

So say I create some custom fields which can be edited via the front page editor.
I save these changes and want users of my theme to be able to see all of the custom fields I have made as soon as the theme is installed
This way, i can create a theme with pre-defined custom fields all over the website so users who install the theme can edit the custom fields straight away.
Otherwise, all the work done via advanced custom fields is rather pointless as when the theme is packaged, the user won't have access to the database that stores the files. I hope what I am asking makes sense!
EDIT: If this is not possible at all then I would accept that as an answer. If it is not possible then I would need to export then import the database for the made custom fields to display on a client's machine after they install the theme correct?
Totally reasonable question, and something that ACF has thought about and created a guide for. There are basically two parts to this guide, which I'll summarize below:
The actual ACF plugin must be included with your theme, which you can do by either:
Bundling the actual ACF PHP code with your theme (the actual plugin files)
Or, provide a link to the ACF plugin page and prompt users to install the plugin as part of your theme readme.
Including the specific custom fields that go with your theme - this is what your question is mostly asking about. Again, a few different ways to do this:
As a new feature of ACF, you can register custom fields with your theme by using JSON files instead of storing the configuration in the SQL database. This is what I personally use, since it is crazy easy to configure (just create an acf-json folder in the root of your theme) and allows you to use version-control (like GIT) to track custom field changes.
If you prefer the old way, you can register your custom fields in your theme's functions.php file.
Some additional information I can provide:
What about the storage of ACF values, not the configuration?
There is only one "database" for a given Wordpress installation, and the way ACF stores values that users have entered for custom fields with a given post is in the "wp_postmeta" table, by association the value with the post ID, field label (changeable), and field ID (permanent).
This is actually beneficial to you as a theme developer, because it means that if a user does something like installs your theme, enters a bunch of custom field values, accidentally uninstalls your theme or switches to a different one, and then wants to re-enable it, no data is lost.
Ensuring ACF gets installed with your theme
If you choose not to bundle the ACF source with your theme, and instead prompt users to manually install the plugin through the plugin directory, you might want to put some checks into your theme to ensure they do so. You can use something like if(!function_exists('the_field')){ /* Block use of your theme until installed */ } in some strategic spots in your theme code to check if ACF is installed, and if it is not, handle that appropriately and prompt admin to install.

Organizing Media Files on Category basis

I've just started learning the WordPress CMS, i have a small PHP programming background and i wanted to masters in WordPress now. for the learning sake, i have started a project on my local server, Where user can register, login and upload images afterwards.
My Question is that, how do i organize all media uploads to a Category Base directory, all uploads should go to a specific directory based on user selection. If user selects "PLACES" category then the uploaded image/file should go to Places directory.
-Thanks
UPDATE
If the above option can not be achieved then how about creating a directory with post slug? like year/month/day/post-slug/images goes here
Only your written articles can be sorted by category.
Unfortunately there is no folder system for images. The only thing you can do is writing a post, import a image into the article and assign a category to the article. But anyway, assigning a category to a image is not necessary.

WordPress: Can I batch upload lots of files (e.g. via a custom field) which will appear on my website as a list of downloadable files?

TL;DR: Can I upload hundreds of files via WordPress (vanilla or with free/premium plugins) which will appear on my website as downloadable files, or would another CMS be better suited to this task?
More info: I'm building a site to replace an old WordPress MU site. My (non-technical) client needs to be able to create a single profile page for each of their employees. Each employee page must include some or all of:
A header image
A text intro
A photo gallery
A list of links
Multiple audio embeds
Multiple video embeds
A list of ~1000 downloadable files, mostly pdf/jpg, divided into subgroups
Ideally the last point would be achieved something like this:
Client adds a custom field and must name it
Client drags any number (realistically 1-100) of files onto the field, or uploads via "add files" function
Files are saved in the backend to a folder named after the custom field
File order is editable by client
The field is output to the HTML page like this:
<h1>Custom Field Name</h1>
<ul>
<li><a>file1.pdf</a></li>
<li><a>file2.jpg</a></li>
...~100
</ul>
Employee A is totally separate from Employee B, C, etc. All employees' pages will be managed by a single user. Their files should exist separately in the backend. The paths to their files will ideally include their name, but only the filename itself needs to be printed to the page. A file system like this would be perfect:
/EmployeeFirstName-EmployeeLastName/Media/YYYY/Filename.xxx
I believe WP's default media file save directories can be customised via plugins.
I'm trying to do this in WP because it's what I've used in the past and it's what my client is familiar with. A friend recommended the Advanced Custom Fields plugin for WP, which I am looking into. I'm an experienced designer but a beginner developer. I accept my naïveté and I'm keen to learn.
Possible structures:
A single WP install with a Page per employee
A Multisite WP install with a Site per employee
Other?
After much searching I'm beginning to think WP might not be a suitable platform for long and busy pages (~80 video embeds per page, added via ACF) with this type of file management requirement. The admin page for my test page is already very slow to update and I haven't even started the file list part.
Since the key feature of this page template will be the ability to list hundreds of downloadable files, it seems logical to me to pick a CMS based on that requirement, rather than pick a familiar CMS and try to force it to do what I want.
Thanks for reading!
I have used
Download Attachments plugin which provide facilities to upload attachment as post meta from admin panel and user can download it from front end. Try it might help you.

Can the administrator attach a file to a Woocommerce order?

I was wondering what the best way to achieve the following:
Customer makes an order (normal functionality)
Once order is placed, the admin needs to upload a pdf attachment related to the order
The customer can then view the attachment(s) when viewing the order
I can see there are plugins where the custom can upload supporting files, but none that cater for the admin to do this.
Why not add a new custom field for that product?
(source: chizzledesigns.com)
So once your client generates the PDF they can upload it just like normal into the media gallery and add the link (or at least the file name) into the Order PDF field for that specific order.
Next you would need to decide how to show the user that in your theme but querying for that meta value should not be difficult.
With default woocommerce functionality the main way to do this is to create virtual downloadable product (but not available on shop pages) and upload your pdf file there. Then when the order would be ready, you should grant access to that virtual product at the order edit page.

Resources