please help me alter my functions.php script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

sakina
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Oct 05, 2012 11:53 am

please help me alter my functions.php script

Postby sakina » Fri Oct 05, 2012 12:08 pm

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):

Code: Select all

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!

sakina
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Oct 05, 2012 11:53 am

Re: please help me alter my functions.php script

Postby sakina » Fri Oct 05, 2012 2:04 pm

i figured it out!

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: please help me alter my functions.php script

Postby seandisanti » Fri Oct 05, 2012 2:35 pm

Awesome! mind sharing your solution in case it could help someone else?


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google Feedfetcher and 3 guests

cron