Change default ‘file not supported’ error message
Change default ‘file not supported’ error message
Change default ‘file not supported’ error message
Reading your comment, I think I have an idea of what to do. I will explain that idea to you, but would not be able to show any code, because it is just an idea, never implemented it yet. I would suggest that you setup your sites to lead images from Amazon AWS S3. And … Read more
I found a solution! My code changed quite a bit… Here is what the functions.php file looks like (which did not change): function wptp_add_categories_to_attachments() { register_taxonomy_for_object_type( ‘category’, ‘attachment’ ); } add_action( ‘init’ , ‘wptp_add_categories_to_attachments’ ); But here is the new code in footer.php, which returns the images from the Media Library, but only from an … Read more
Instead of trying to use “excluded categories”, I think you should use “included categories”. One solution would be : create an array of the catagories you want to exclude create an array of all the categories use “array_diff” to build an array of the categories to be included Or maybe you can work with the … Read more
Can we reuse WordPress drag drop media upload in plugins?
Try: <select class=”size” name=”size” data-setting=”size”> <option value=”thumbnail”>thumbnail</option> <option value=”medium”>medium</option> <option value=”medium_large”>medium_large</option> </select>
I suppose, you didn’t create table imageupload or can’t create folder if_images at your plugin folder. As a proposal I suggest you to use built-in WordPress functions and wordpress tables or create table on plugin activation. To create new table use function dbDelta. If you want to upload user files, use well-documented wp_handle_upload function. For … Read more
Can I use get_attached_media() to get the images referenced on a page, even if they’re not formally attached? No, if they’re not attached they won’t be attached. I assume you’re talking about images in your posts that are offsite? If so, you need to download them, create an attachment post, attach it to the post, … Read more
If you add this in the functions.php file in your themes folder: add_filter(‘upload_dir’, ‘new_upload_dir’); function new_upload_dir( $param ){ $mydir=”/wp-content/uploads”; $param[‘path’] = $param[‘path’] . $mydir; $param[‘url’] = $param[‘url’] . $mydir; error_log(“path={$param[‘path’]}”); error_log(“url={$param[‘url’]}”); error_log(“subdir={$param[‘subdir’]}”); error_log(“basedir={$param[‘basedir’]}”); error_log(“baseurl={$param[‘baseurl’]}”); error_log(“error={$param[‘error’]}”); return $param; } It should change the directory the images are uploaded into.
I figured it out. It was a series of silly mistakes, really. $args1 should be ‘post_status’ => ‘publish’, [not ‘published’]. $args for $query should include ‘post_status’ => array( ‘publish’, ‘inherit’ ).