Hello guys,
Can someone help me with a little thing?
I dont have too much php knowledges, and I have sure that someone with good knowledges can fix this for me in 2 minutes
Let me try to explain:
I have this code:
Where you can see this line:
Below that code I have this one:
Where you can see this line:
This code will show an default image "images/favi.png", but when I upload a image (favicon), will show the one that I uploaded.
Everything well here...
But I don't want to show the default image in a img src tag... I want to show in a sprite image using span.
This is the code that I want to show for default image only:
Instead of:
Can someone please help me?
Thanks !!!
Can someone help me with a little thing?
I dont have too much php knowledges, and I have sure that someone with good knowledges can fix this for me in 2 minutes
Let me try to explain:
I have this code:
PHP:
<?php $post_favicon_icon = (get_post_meta(get_the_ID(),'post_favicon_icon',true))?get_post_meta(get_the_ID(),'post_favicon_icon',true):get_template_directory_uri().'/images/favi.png'; $post_external_link = (get_post_meta(get_the_ID(),'post_external_link',true))?get_post_meta(get_the_ID(),'post_external_link',true):'#'; $new_post_added = (get_post_meta(get_the_ID(),'new_post_added',true))?'<span class="new_txt">'.get_post_meta(get_the_ID(),'new_post_added',true).'</span>':''; if(get_field( "nofollow_tag" )) { $nofollow_tag = 'rel="nofollow"'; } else { $nofollow_tag = ''; } ?>
Where you can see this line:
$post_favicon_icon = (get_post_meta(get_the_ID(),'post_favicon_icon',true))?get_post_meta(get_the_ID(),'post_favicon_icon',true):get_template_directory_uri().'/images/favi.png';
Below that code I have this one:
PHP:
<?php if(get_field( "add_site_favicon_position" )) { $favicon_position = explode(',', get_field( "add_site_favicon_position" )); echo '<span style="background-position: '.$favicon_position[0].'px '.$favicon_position[1].'px;" class="icon"></span>'; } else { echo '<span><img src="'.$post_favicon_icon.'" /></span>'; } ?>
Where you can see this line:
echo '<span><img src="'.$post_favicon_icon.'" /></span>';
This code will show an default image "images/favi.png", but when I upload a image (favicon), will show the one that I uploaded.
Everything well here...
But I don't want to show the default image in a img src tag... I want to show in a sprite image using span.
This is the code that I want to show for default image only:
Code:
<span style="background-position: -0px -0px;" class="icon"></span>
Instead of:
Code:
<img src="//domain.com/wp-content/themes/customtheme/images/favi.png">
Can someone please help me?
Thanks !!!