custom thumbnail image size not working
I Used Regenerate Thumbnails plugin to generate thumbnails
I Used Regenerate Thumbnails plugin to generate thumbnails
You need to hook into the image_send_to_editor filter. This allows you to modify the markup used when inserting an image into the content editor. Something like this should work: add_filter(‘image_send_to_editor’, ‘my_add_rel_nofollow’, 10, 8); function my_add_rel_nofollow($html, $id, $caption, $title, $align, $url, $size, $alt=”” ){ // check if there is already a rel value if ( preg_match(‘/<a.*? … Read more
You are using the size parameter of wp_get_attachment_image_src in a wrong format. This parameter can be: A string: keyword of the image size; thumbnail, medium, large, full or any other custom size previously registered). A 2-items array representing the width and height; for example, array( 100, 100 ). So, you have to change this: $thumb … Read more
Just use the public API functions: has_shortcode( $content, $tag );. It uses shortcode_exists( $shortcode ); internally to search the global $shortcode_tags array for the shortcode you are searching for. If that is successful, it uses get_shortcode_regex() to search for the actual shortcode – this will save you quite some time and avoid mistakes. the_title(); if … Read more
Hey Only Change the code like this function cult_customizer_register( $wp_customize ) { $wp_customize->add_section( ‘cult_topic_thumb’ , array( ‘title’ => __( ‘Topic of the Week’ ), ‘priority’ => 36, ‘description’ => ‘Allows you to upload an image for your topic of the week section.’, ) ); $wp_customize->add_setting( ‘display_topic_thumb’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘display_topic_thumb’, array( ‘label’ => … Read more
Instead of your code for image, use this following. <?php $thumb_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 120, 90, true ); ?> <img src=”https://wordpress.stackexchange.com/questions/172495/<?php echo $thumb_image[0]; ?>” alt=”<?php echo esc_html( get_the_title() ); ?>” width=”<?php echo $thumb_image[1]; ?>” height=”<?php echo $thumb_image[2]; ?>” /> Let me explain a little what it’s doing. We are returning PHP array of … Read more
You have two issues here. The use of $image->ID in this line wp_get_attachment_image($image->ID, ‘video-thumb’); This will give you the following error: NOTICE Error: [8] Undefined variable: image In all honesty, I think that should actually be $post->ID get_permalink() returns the permalink to the current post, which in this case is the image. If you want … Read more
Well if you want to do this yourself first you’ll have to make sure that the form supports enctype: /** Add Encryption Type to User Forms to allow Uploads **/ function profile_form_edit( ) { echo ‘ enctype=”multipart/form-data”‘; } add_action( ‘user_edit_form_tag’ , ‘profile_form_edit’ ); Then you’re going to have to add a new field that allows … Read more
I can tell how to do it with WordPress functions, which is quite easy and you won’t lose any important stuff: Upload the default.jpg image using WordPress media manager. Note the ID of the image. Get all posts from your custom post type and run set_post_thumbnail() for each one. Example: add this code to functions.php … Read more
yes, the naming convention for resized images is name-{width}x{height}.extension. Is it good enough info to base a regex on? in practice most likely yes, but in theory no. You just can’t know if mark-20×20.jpg was not simply uploaded that way, and even in places where you know that a resized image should be used you … Read more