• Resolved dileepraja

    (@dileepraja)


    Hi i am uploading two images main logo and small logo when main logo appears small logo should be hide small logo appear main logo should be hide using option tree how

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    <a>" >
    					<img src="<?php if ( isset( $logoUrl['background-image'] ) ) echo $logoUrl['background-image']; ?>" id="main-logo" />
    					<img src="<?php if ( isset( $smallLogoUrl['background-image'] ) ) echo $smallLogoUrl['background-image']; ?>" id="main-logo-min" />
    				</a>
Viewing 1 replies (of 1 total)
  • Your code has conditionals but it’s only checking if both is set, if so, it’s displaying both logos. Instead, break the two down into one single conditional, and set the image source and id’s depending on what you want. You could probably compress this a bit, but should do the job.

    <a>
    	<?php
    	$src = '';
    	$id  = '';
    	if( isset( $logoURL['background-image'] ) ){
    		$src = $logoURL['background-image'];
    		$id = 'main-logo';
    	} elseif( isset( $smallLogoUrl['background-image'] ) ){
    		$src = $smallLogoUrl['background-image'];
    		$id = 'main-logo-min';
    	}
    	?>
    	<img src="<?php echo $src; ?>" id="<?php echo $id; ?>" />
    </a>
Viewing 1 replies (of 1 total)
  • The topic ‘logo’ is closed to new replies.