A link (not in the post) to download a specific PDF file

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

How can I modify the media upload form fields?

Would maybe look into do_action( ‘pre-upload-ui’ );. Here is my first thoughts, please note it’s not tested but should get you in the right direction. add_action( ‘pre-plupload-upload-ui’, ‘sd_extra_info’ ); function sd_extra_info() { # see wp-includes/media-template.php print ‘<pre> Some more info here </pre>’; }

Stop image resizing in particular case – is that possible?

Use the Filter Hook intermediate_image_sizes_advanced for control the resize function for different sizes. This hook get a array of different sizes and can control your resize with your requirements. Add your logic inside a plugin and remove sizes via this hook. // the hook in core $sizes = apply_filters( ‘intermediate_image_sizes_advanced’, $sizes ); A small example … Read more

When does WP resize an image file

WordPress resizes the image when you upload it. By default it provides 4 sizes of your image (providing your image is bigger than the ‘large’ size). the_post_thumbnail(‘thumbnail’); // Thumbnail (default 150px x 150px max) the_post_thumbnail(‘medium’); // Medium resolution (default 300px x 300px max) the_post_thumbnail(‘large’); // Large resolution (default 640px x 640px max) the_post_thumbnail(‘full’); // Original … Read more

“page not found” due to hat character (“^”) in a upload file name

This is a filter I use to keep my clients from adding special characters to their filenames, should work for you – you’ll have to reupload the file though. /** /* Sanitize Uploaded Filenames /* @param array $file /* @return array $file */ function sanitize_file_uploads( $file ){ $file[‘name’] = sanitize_file_name($file[‘name’]); $file[‘name’] = preg_replace(“/[^a-zA-Z0-9\_\-\.]/”, “”, $file[‘name’]); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)