Echo list attachment size in post

wp_get_attachment_thumb_url() doesn’t accept three parameters. It takes one– the attachment ID. And, as you might guess from the name of the function, it return the thumbnail URL *_thumb_url. If you’d have simply checked the Codex entry for the function you’d have seen that. If you’d check the Codex, you’d see several other things too Don’t … Read more

Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio

Here is my resolution: Download and unzip JCrop and unzip jquery.Jcrop.min.js & jquery.Jcrop.css to the js & css sub-directory respectively under the theme template directory. Place the following code in header.php just before </head> (you need to comment out the first line if you’ve already include the jquery.min.js in the other place): <script src=”https://wordpress.stackexchange.com/questions/209358/<?php echo … Read more

add_image_size not working

For this to work, you must have added the thumbnail support. You can use the following code in functions.php to add the support add_theme_support( ‘post-thumbnails’ ); add_image_size(‘poster-full’, 450, 9999, false); and to display the image: if ( has_post_thumbnail() ) { the_post_thumbnail(“poster-full”); }else{ echo “No thumbnail”; }

Category page with thumb is ok but can’t do the same with tags

What am i missing? ‘tag’ may be a valid argument for get_posts() via WP_Query, but requires the tag slug in that case. Try using ‘tag_id’ instead. get_posts() apparently enables ‘category’, but expects the the ID, even though in WP_Query the same argument is ‘cat’ (vs. ‘category_name’, et al). A little confusing, perhaps, altogether. I know … Read more

Using Image Sizes for Custom Post Types outside the Loop

You are doing wrong on this part the_post_thumbnail($page->ID, “my-non-working-size”); For the_post_thumbnail() you don’t need to pass post ID, you just have to pass size and attr. More Info – the_post_thumbnail() So try like this the_post_thumbnail(“my-non-working-size”); without passing post ID. Your markup messed up so I’m not sure your actual markup structure. Here is working example … Read more

Else/If Statement to Display Photo Descriptions

How about like this: <div style=”position: relative”> <?php the_post_thumbnail(‘large’); $imagedesc = get_post(get_post_thumbnail_id())->post_content; if(!empty($imagedesc)) { echo ‘<span style=”position:absolute; bottom:9px; right:0; color:#FFF; background:rgba(0,0,0,0.8); padding:4px 6px; font-size:0.7em”>’; echo $imagedesc; echo ‘</span>’; } ?> </div>

get_post_thumbnail does not display thumbnail

Make sure to use echo with get_the_post_thumbnail(): echo get_the_post_thumbnail(64 , ‘post-thumbnail’, array( ‘class’ => ‘img-format-big’ ) ); In WordPress, a rule of thumb (no pun intended) is to use echo with functions prefixed with get_. Functions prefixed with the_ on the other hand, display their output immediately (e.g. the_post_thumbnail() ).

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