How do I display the featured image from an image gallery using a reference in code? (example within)

UPDATED First, let’s create a new image size. We could update one of the existing sites, but we’ll just add a new one for experience sake. Open up your functions.php file and add the following: if ( function_exists( ‘add_image_size’ ) ) { add_image_size( ‘new-size’, 500, 500, true ); // Cropped add_image_size( ‘another-size’, 400, 600 ); … Read more

Replace image urls(absolute instead of relative) by using filter in single page

Something like this should do it, you may have to fiddle with the preg_replace() to get it to work the way you need, but the concept (and, more importantly imo, the regex, is there). if( is_single() ) { add_filter( ‘the_content’, ‘wpse44503_filter_content’ ); } function wpse44503_filter_content( $content ) { $regex = ‘#src=(“|\’)’. ‘(/images/(19|20)(0-9){2}/(0|1)(0-9)/[^.]+\.(jpg|png|gif|bmp|jpeg))’. ‘(“|\’)#’; $replace=”src=””.get_site_url( $2 … Read more

Link to full-size image for subscriber only

Sure it is… its a 3 step process.. Check if user is logged in return check and create an if condition return the BIG image link or not at all (right?) The code (not check for user level since subscriber is the lowest level) if ( is_user_logged_in() ) { echo ‘<a href=””><img src=”LINK TO BIG … Read more

Metabox image upload value

It appears that $field[‘custom_image’] isn’t passing what you want it to. The returned values do not appear to be correct. You want to put the key of the meta value you need as the second variable in the get_post_meta() function, for example: $image_upload = get_post_meta($post->ID, ‘_my_image_id’, true); Each custom meta field you create has a … Read more

CSS images don’t show up with bloginfo

If your style.css is in /wp-content/themes/themedirectory, and your image is at /wp-content/themes/themedirectory/images/image.jpg, then your css will be this: background-image: url(“images/image.jpg”); You can’t use php in a css file, it will not parse unless included via php (instead of with <link>).

Create an instance of add_image_size

When you upload an image, it’s saved, and a copy is created for every image size, resized to the appropriate dimensions. When you specify a set of dimensions manually, e.g. wp_get_attachment_image_src($id, array(57, 57)) the 57×57 dimensions are compared to the image sizes, and the nearest image size is chosen and that image is returned. So … Read more

How can I externally retrieve a post’s custom sized image

Try RSS, like Magpie RSS – PHP RSS Parser or Google Feed API — Google Developers to pull posts without using WP’s library. Google Groups has forum posts on pulling images, and someone at SO found a way to pull images from Magpie: https://stackoverflow.com/questions/3490740/pulling-images-from-rss-atom-feeds-using-magpie-rss There are lots of other resources via Google.