Jump to content

gabby25

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by gabby25

  1. New to PHP, I wrote a shortcode to use in WP that outputs a nav bar with some icons. One will link to a url, one to a pop up plugin (through a class), and one a phone number. The shortcode will then look like this [footer-btn url="link here "]Name of Icon Here[/footer-btn] Right now when I put the short codes into word press, I get duplicates of the URL ones.

    function footer_btn_function($atts, $content){
    
      extract( shortcode_atts(
    
        array(
    		
    	'class' => '',
    		
    	'phone' => '',
    		
    	'url' => ''
    
        ), $atts )
    
      );
    	
    	if($class){
    		'<a class="text-link" href='.$class.'><img class="popmake-73310 footer-btn mobile" src="'.get_template_directory_uri().'/images/faq-mobile-white.png">'.$content.'</a>';
    	}
    	
    	if($phone){
    		
    		$output .= '<a class="text-link" href="tel:'.$phone.'" target="_blank"><img class="footer-btn mobile" src="'.get_template_directory_uri().'/images/phone-mobile-white.png">'.$content.'</a>';
    		
    	};
    		
    	if($url){
    		
    		$output .= '<a class="text-link" href="tel:'.$url.'" target="_blank"><img class="footer-btn mobile" src="'.get_template_directory_uri().'/images/vacation-rentals-mobile-white.png">'.$content.'</a>';
    	};
    	
    	if($url){
    		
    		$output .= '<a class="text-link" href="tel:'.$url.'" target="_blank"><img class="footer-btn mobile" src="'.get_template_directory_uri().'/images/chat-mobile-white.png">'.$content.'</a>';
    	};
    
      return $output;
    
          
    }

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.