Tag Info

New answers tagged

0

The bloginfo() function outputs immediately. since you're storing to a $variable you'll want to use get_bloginfo() instead. also, you're missing a concatenation. $large_image_url = get_bloginfo('template_directory') . '/library/images/default-header-image.jpg';


0

While looking at some code for another issue I had a lightbulb went off in my head and brought me back to this problem. So after several tries at it I came up with this... function add_image_to_feed( $thumbz){ if( is_feed() ){ $def_thmb = get_post_meta( get_the_ID(),'def_thmb',true); $subPath = tube_sub_dir_path(get_the_ID()); $upload_dir ...


0

After trying to ask help from others, I got my solution and here I am sharing that below. First there is no use of 'in_same_cat' => false, in upper code and second get_next_post(true);, get_previous_post(true); is used to show next/prev post from current post categories but if you want to show all posts in next/prev then you have to use only ...


0

Lazy Load really does not require no coding, you can use the Lazy Load plugin (just activate it). I also suggest providing different thumbnail sizes on the basis of the required dimension for the position (and you could even deliver them differently on the basis of the screen size, if you wish, to allow rensponsive themes work well). Other ideas can be ...


0

Check out get_the_post_thumbnail() $image_thumb = get_the_post_thumbnail( get_the_ID(), 'thumbnail'); Here's a more specific example: while (have_posts()) : the_post(); echo '<article class="search-entry clearfix">'; $image_thumb = get_the_post_thumbnail( get_the_ID(), 'thumbnail'); echo ( $image_thumb ) ? sprintf('<a href="%s" ...


1

I found the solution from a Wordpress forum and this is what they used. Works perfect <?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' ); $image = $image[0]; ?> <?php else : $image = get_bloginfo('stylesheet_directory') . ...


2

Since this is a plugin, it's probably going to get axed, but generally speaking in WordPress if you want to get a posts featured image and you have access to the post ID (which I'm assuming you do), you can always do this: $thumb_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); So without looking at the plugin, it looks like you might ...


0

I had the same problem after I moved one of my sites. The best solution I could come up with was to delete all of the database entries for my media (open the wp-posts table, search for all entries with a post_type of attachment and delete them. Then install the plugin Add from Server and I went through each folder, selecting only the parent image (NOT the ...


0

well, what i did finally is to use taxonomies instead of aggregation because cron based solutions are a little bit tricky with server resources and might reduce the performance: install taxonomies plugin add a code to it to attach the blogid of the post as custom field when saving the post add a function to your theme's functions.php that pulls the image ...


0

I Used Regenerate Thumbnails plugin to generate thumbnails


0

I accomplished this by first hooking into the 'current_screen' action and making a determination if my post_type was set, then adding the filter. There may be a shorter way but this works if you need to change the text only on a given post type. public function set_featured_image_filter(){ $screen = get_current_screen(); if( ...


2

First get the registered image sizes and the featured image attachment id: $sizes = get_intermediate_image_sizes(); $post_thumbnail_id = get_post_thumbnail_id(); Loop through the registered sizes and create an array: $images = array(); foreach ( $sizes as $size ) { $images[] = wp_get_attachment_image_src( $post_thumbnail_id, $size ); } Combined as ...



Top 50 recent answers are included