Wordpress customization

Status
Not open for further replies.

lucab

New member
Jan 4, 2007
677
3
0
I am using the socializer plugin by Anders Bergman. If I want to show an image, as opposed to the text 'Social bookmark this post,' what is the PHP code that I put in?

Here is the original plug-in script:

Code:
<?php
// add socializer link
function socialize_adb($text_adb) {

    // default
    if ($text_adb == '') {
        $text_adb = "Social bookmark this post";
    }

    $link_adb = "<a href=\"http://ekstreme.com/socializer/?url=".get_permalink()."&title=".get_the_title($id)."\">".$text_adb."</a>";

    // display link
    echo ($link_adb);

}

?>
I experimented with inserting an <img> element, but I can't seem to get it to work. I keep getting 'unexpected T_STRING.' Or that it expected a ) in place of a ". Obv I am a total rookie to PHP.

Thanks in advance

note:this info is obv available for use in general php, but I am not sure if what I have found is relevant, considering that this goes in the $text_adb
 


I haven't used this plugin but just by looking at the code if you want to replace the text with an image switch this line:

Code:
$link_adb = "<a href=\"http://ekstreme.com/socializer/?url=".get_permalink()."&title=".get_the_title($id)."\">".$text_adb."</a>";

With this
Code:
$link_adb = "<a href=\"http://ekstreme.com/socializer/?url=".get_permalink()."&title=".get_the_title($id)."\"><img src=\"url of image\" border=0></a>";

Note that if you want to use quotation marks you have to put a backslash in front of them.

If you wanted to use different image based on whats in $text_adb try this

Code:
$link_adb = "<a href=\"http://ekstreme.com/socializer/?url=".get_permalink()."&title=".get_the_title($id)."\">";
switch($text_adb)
{
  case 'string 1':
    $link_adb .= "<img src=\"path/to/image.gif\" border=0>";
    break;
  case 'string 2':
    $link_abd .= "<img src=\"path/to/image2.gif\" border=0>";
    break;
}
$link_adb .= "</a>";
 
  • Like
Reactions: lucab
Status
Not open for further replies.