Need Help with function.php file

Discussion in 'PHP' started by c10h12n2o, Oct 5, 2012.

  1. #1
    Hi everyone,


    I am relatively new to PHP, and I have been having trouble adjusting part of the functions.php file on a theme I purchased to make my site work like I want it to. Right now, I am using a theme that has a function where you can directly upload social media images and it will upload them with a link to your account. I am working on an e-commerce site, so I'd like to upload credit card images with no link instead, but when I try to do this, I get an error message saying that I can't upload a photo without a link.


    Here is the current code that I need to adjust (I am pretty sure):
    function _wip_show_social_link(){	$data = get_option('bd_fan_icons');	$path_info = wp_upload_dir();	$uri = ( is_ssl() ) ? preg_replace( '|^http://|', 'https://', $path_info['baseurl'] ) : $path_info['baseurl'];	if( !is_array($data) ) return false;		$links = '<ul class="builder_social_icons">' . "\n";	foreach( $data as $d ){		$iconImg = $d['icon'];		$ic =  $uri . $iconImg['subdir'] . '/' . $iconImg['file'];				$links .= '<li>' . "\n";		$links .= '<a href="'.$d['link'].'" title="'.$d['text'].'" target="_blank"><img src="'.$ic.'" alt="'.$d['text'].'" /></a>' . "\n";		$links .= '</li>' . "\n";	}	$links .= '</ul>' ."\n";		return $links;}
    
    PHP:
    Can someone please help me learn how to turn this into a function that allows an image to be posted without requiring a link?


    Thanks in advance!
     
    c10h12n2o, Oct 5, 2012 IP
  2. kevinn13

    kevinn13 Greenhorn

    Messages:
    24
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    11
    #2
    If this is the correct function then <a href="'.$d['link'].'" title="'.$d['text'].'" needs to be replaced with <a href="" title="'"

    Then just enter a link when you upload the image but it shouldn't show.
     
    kevinn13, Oct 5, 2012 IP
  3. kevinn13

    kevinn13 Greenhorn

    Messages:
    24
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    11
    #3
    or better still remove the whole section <a href="'.$d['link'].'" title="'.$d['text'].'" target="_blank">
     
    kevinn13, Oct 5, 2012 IP
  4. c10h12n2o

    c10h12n2o Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    that worked! thank you so much for your help!
     
    c10h12n2o, Oct 5, 2012 IP