Using dashboard uploader instead of FTP
If you’re on a shared server, it’s unlikely your host will correct this issue, but you can add the upgrade constants to your wp-config file so it will at least stop asking every time.
If you’re on a shared server, it’s unlikely your host will correct this issue, but you can add the upgrade constants to your wp-config file so it will at least stop asking every time.
You can use CSS attribute selectors to accomplish this without changing anything in the WP Admin or the HTML. A Google search for “css file type icons” comes up with several results, but I’ll explain the basic idea for you here. An attribute selector lets you style any html tag with a matching attribute. There … Read more
The upload directory and URL paths are stored in the options database. You can change them using update_option(): update_option( ‘upload_path’, ABSPATH . ‘/path/to/uploads’ ); update_option( ‘upload_path_url’, site_url( ‘/uploads/’ ) ); However, it’s best not to use this in a publiuc plugin, as it will cause numerous issues. We can instead hook into the filters that … Read more
By default, WordPress will automatically generate a few different sizes of images. You can adjust the sizes here: Dashboard -> Settings -> Media -> Image Sizes. If you want to prevent certain image sizes from generating upon your uploaded images, you could use the filter intermediate_image_sizes to remove the generation of certain image sizes. Example … Read more
When you or the client add the gallery shortcode, you can add an “orderyby” option to specify the order of the images. Per the Codex page on the gallery shortcode: … will do what you’re wanting.
The solution was to simply wrap my JQuery in a function like this: $(‘#wpcontent’).ajaxStop(function() { $(‘.attachment-filters’).change(function(){ if($(this).val() === ‘uploaded’){ alert(“Uploaded images selected”); } else { alert(“Other option selected”); } }); });
I believe by default these folders are created by user interaction, however, it’s possible that a plugin may be calling a function to create these monthly upload folders. Note that using this function will create a subfolder in your Uploads folder corresponding to the queried month (or current month, if no $time argument is provided), … Read more
The pdf is itself an attachment post so in wordpress template hierarchy we can create a template named pdf.php Then you can write following code in it which force download the pdf file. <?php if (have_posts()) : the_post(); $pdf_title = $post->post_title; $pdf_src = get_attached_file($post->ID ); $bytes = filesize( $pdf_src ); header(“Pragma: public”); // required header(“Expires: … Read more
$is = get_children(“post_parent=$id&post_type=attachment&post_mime_type=image”); foreach($is as $i) { $url = wp_get_attachment_image_src($i->ID, ‘full’); $caption = $i->post_title); } $id is the id of your post. See http://codex.wordpress.org/Function_Reference/get_children
If you have the image in your media library you can just loop trough them and create post via wp_insert_post. function import_post_from_imgs() { $images = get_posts(‘post_type=attachment&post_status=inherit&posts_per_page=-1’); // just a minimal security check if ( ! current_user_can(‘publish_posts’) ) return; if ( ! empty($images) ) { foreach ( $images as $image) { // prevent duplicate if for … Read more