Change logo image condition based on url

if (strpos($_SERVER[“REQUEST_URI”], “www.radarhh.com/stage/fr/”) !== 0): The $_SERVER[“REQUEST_URI”] typically doesn’t contain the domain name. And you should be checking if it is zero, since strpos returns the position of the string, or false if it’s not in the string. Try this instead: if ( strpos( $_SERVER[‘REQUEST_URI’], ‘/stage/fr/’ ) === 0 ) : Also, you have this … Read more

I want to rel=nofollow wordpress images

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

Specify automatically the height and weight of the images

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

How To Display Author Photo In WordPress without any plugin?

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

How does wordpress name resized image copies?

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

HTTP error when uploading an image

I’ve had the same problem and found it was due to the upload file size set for the server (in my case 2mb). There is another setting which escapes me at this point, but is basically a limit on the amount of space that can be used to process uploaded images…which WordPress does when it … Read more

Logo on the tab

I believe your question is about creating a “favicon”. This is a small image that is served up by your site and appears on each browser tab you may have opened. The WordPress Codex lists a convenient step-by-step on creating a favicon. http://codex.wordpress.org/Creating_a_Favicon Creating a Favicon A favicon can be created using any graphics/image editing … Read more

Redirect Image Url to a page via htaccess

You’ll need to add a rewrite rule to your .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_REFERER} !/wp-admin/ [NC] RewriteRule ^wp-content/uploads/.+?\.(jpe?g|png|gif|svg)$ /my-page [R=301,L] </IfModule> Add this after anything added by WordPress. You’ll need to replace /my-page with the slug of the page you’d like to redirect to.