Tangler Discussion Forums

Discuss

Topics

Click a Topicto start discussing

    Can you please change the visit_site_link function so it takes 2 parameters like this: visit_site_link('some title','data for a tag');  As an example, we'd like to use something like visit_site_link('Visit Site','class="external"'); and that would produce <a class="external" href="xxx">...  I know we could do simple styling by putting the function within a span, but this would also allow us to pass in javascript etc.

     

    Thanks for considering this.

    2008-09-24 08:33:07.0

    Since the plugin is not encrypted you can edit the code as you wish to add your own features. But here's an updated version of the function for you:

    -----------------------------------------------------------

    function visit_site_link($text = 'Visit This Site', $html = null, $custom_id = null) {
        global $id, $wpdb;
        $pid = $id;
        if (is_numeric($custom_id))
            $pid = $custom_id;

        $result = $wpdb->get_results("SELECT url FROM " . $wpdb->visitlinks . " WHERE post_id = " . $pid);

        if (count($result) > 0 && $result[0]->url != "http://") {
            echo '<a href="' . $result[0]->url . '"';
            if (!empty($html)) echo ' ' . $html . ' ';
            echo '>' . $text . '</a>';
        }

    }

    2008-09-25 01:35:52.0
To send a message, Join Now (it's quick and free) or Sign In
Edit Topic
Delete Topic
Are you sure you want to delete the topic