How to store media files in subdomain

You can move the uploads folder to the sub domain by doing this Open up your wp-config.php file, located at the root of your WordPress installation, and add the following code: define(‘UPLOADS’, ‘http://images.mydomain.com/uploads’); The codex specifies that it should be added before the line that says require_once(ABSPATH.’wp-settings.php’);. Make sure the uploads folder is writable.

add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2

I’m running WordPress 3.5.2. The following is an excerpt from my functions.php file, which correctly allows me to select a thumbnail size when I upload an image. // Basic setup for thumbnail support. function themeSetup() { add_theme_support(‘post-thumbnails’); add_image_size(‘tiny’, 128, 79); add_image_size(‘small’, 256, 158); add_image_size(‘medium’, 384, 237); add_image_size(‘large’, 512, 316); } add_action(‘after_setup_theme’, ‘themeSetup’); // Addes custom … Read more

Change Image URL to a CDN

Since the major adoption of Responsive Images and the addition of new srcset attribute to the <img> element. WordPress has to evolve too. WordPress 4.4 added the responsive images feature. If you inspect the src attribute it might point to the CDN, however, you still need to consider the srcset attribute which might still be … Read more

Uploading an image as featured image from frontend form

I have found the problem. Problem was in a .js file. This code is causing the problem : $et_contact_form.live(‘submit’, function() { et_contact_error = false; et_message=”<ul>”; $et_inputs.removeClass(‘et_contact_error’); $et_inputs.each(function(index, domEle){ if ( jQuery(domEle).val() === ” || jQuery(domEle).val() === jQuery(this).siblings(‘label’).text() ) { jQuery(domEle).addClass(‘et_contact_error’); et_contact_error = true; var default_value = jQuery(this).siblings(‘label’).text(); if ( default_value == ” ) default_value = … Read more

How to place an image into header.php? [closed]

Don’t use a relative URL. If you look at the source you are probably trying to load the image from http://sitename.com/images/ when what you likely want is http://sitename.com/wp-content/themes/themename/images/. Assuming the image is in the theme directory in a folder that shares a directory with style.css, do this: <img id=”topL” src=”https://wordpress.stackexchange.com/questions/78271/<?php echo get_stylesheet_directory_uri(); ?>/images/img01.png”/> http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri

Has wp_get_attachment_image_src changed from 3.2.1 to 3.5.2?

Try this first Make sure that the post in question has its Featured Image (formerly Post Thumbnail) set. Then… Going by our comment thread, here’s something else to try. function gangmei_get_the_post_thumbnail_url($post_id = NULL) { /* * global $id; * $post_id = (NULL === $post_id) ? $id : $post_id; * $src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), ‘full’); * $src … Read more

Uploaded image not appearing in custom post type

How About you try this code for your attachment $uploaded_file = wp_handle_upload( $file, $upload_overrides ); $attachment = array( ‘post_mime_type’ => $uploaded_file[‘type’], ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, basename( $uploaded_file[‘file’] ) ), ‘post_content’ => ”, ‘post_author’ => ”, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_parent’ => $new_reseller_id, ‘guid’ => $uploaded_file[‘file’] ); $attachment_id = wp_insert_attachment( $attachment, $uploaded_file[‘file’] ); $attach_data … Read more

custom image size with New Media Manager in wordpress 3.5

You will need to paste your code in order for us to review where the issue is, however, I can demonstrate how I accomplish this in WordPress v3.5 Please observe the comments in my_insert_custom_image_sizes: function my_insert_custom_image_sizes( $sizes ) { // get the custom image sizes global $_wp_additional_image_sizes; // if there are none, just return the … Read more