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:
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;
}
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!