How do I use the WP image functions in a page template?
There are several drag and drop WordPress themes, plugins and frameworks available. Maybe you could pick apart http://wordpress.org/extend/themes/presswork
There are several drag and drop WordPress themes, plugins and frameworks available. Maybe you could pick apart http://wordpress.org/extend/themes/presswork
Might wanna look at https://developer.wordpress.org/reference/functions/wp_upload_dir/ In definition there is a hook upload_dir, you can use that to change path. Haven’t tried or tested it, but you can give it a try.
Have you enabled debugging in wp-config.php change define(‘WP_DEBUG’, false); to define(‘WP_DEBUG’, true); This will cause WordPress and php to generate a lot more error messages. With very little detail to go on, my first guess would be file permissions on the upload directory on your server.
I had do adapt Backbone for a project of mine, so I might help to get you started. If you want to adapt the rendering of your Backbone Templates, you need to rewrite them, because there are no built in filters for existing Templates. add_action(‘print_media_templates’, ‘print_my_media_templates’); function print_my_media_templates() { ?> <script type=”text/html” id=”my-custom-template”> //TODO: Copy … Read more
I tried to get my head around this yesterday and I came pretty close solving this issue. But i gave up in the end, cause it was getting too complicated, when start thinking about all the tools, that you want to include/exclude. If you still wanna do this on your own, these two filters are … Read more
You can use pre_get_posts to filter the query. So you can retrieve a category from query vars the retrieve the post with that category set the media query to include only post having that posts as parent To give an UI you can use restrict_manage_posts hook to output a category dropdown. add_action(‘pre_get_posts’, ‘my_filter_media_by_cat’); add_action( ‘restrict_manage_posts’, … Read more
Well, I found the answer myself. I hope it helps others: I replaced both instances of: if ( selected ) { selection.add( wp.media.attachment( selected ) ); } with: selection.reset( selected ? [ wp.media.attachment( selected ) ] : [] ); Apparently, the reset() function can be used to empty an array and then add elements to … Read more
wp_upload_bits() uses wp_upload_dir() which fires the upload_dir filter allowing you to modify the upload directory’s path, sub-directory and URL. So you can use that filter to “force” wp_upload_bits() to use a custom path by doing something like: // Demo to get the image data. $url=”https://logo.clearbit.com/starcomww.com”; $content = file_get_contents( $url ); $_filter = true; // For … Read more
You can use wp_enqueue_media() in your admin_enqueue_scripts hook. In a javascript file hook it into a button and use insert event to capture the selected image’s details $(‘.media-button’).click(function() { var media_uploader = wp.media({ frame: “post”, text : “Add image”, state: “insert”, multiple: false }); media_uploader.on(“insert”, function(){ var json = media_uploader.state().get(“selection”).first().toJSON(); var image_name = json.filename; var … Read more
RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^wp-content/uploads/([^/]*\.(pdf|zip))$ filecheck.php?file=$1 [QSA,L] This actually looks OK, except if you have additional subdirectories within the /uploads directory? An alternative is to include an additional condition on the original rule that only rewrites the request if the request ends in .pdf or .zip. For example: RewriteCond %{REQUEST_URI} \.(pdf|zip)$ [NC] RewriteCond %{REQUEST_FILENAME} -s … Read more