Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Miguel López

    (@atallos)

    You need to go to bp-xprofile-custom-fields-type.php of my plugin, you need to change two functions: bxcft_get_field_data and bxcft_get_field_value. Search for:

    elseif ($field->type == 'web') {
            if (strpos($value, 'href=') === false) {
                $value = str_replace("<p>", "", $value);
                $value = str_replace("</p>", "", $value);
                return '<p><a href="'.$value.'">'.$value.'</a></p>';
            }
        }

    and

    elseif ($type == 'web') {
            if (strpos($value, 'href=') === false) {
                $value = str_replace("<p>", "", $value);
                $value = str_replace("</p>", "", $value);
                return '<p><a href="'.$value.'">'.$value.'</a></p>';
            }
        }

    You can put there the target=”_blank”.

    Andres Felipe

    (@naturalworldstm)

    Can I do this in function.php in order to not lose the changes when You update the plugin?

    sorry to re open it but i’m not sure where to put the code
    I tried this but doesn’t work

    elseif ($field->type == 'web') {
            if (strpos($value, 'href=') === false) {
                $value = str_replace("<p>", "", $value);
                $value = str_replace("</p>", "", $value);
                return '<p><a href="'.$value.'" target="_blank">'.$value.'</a></p>';
            }
        }

    And

    elseif ($type == 'web') {
            if (strpos($value, 'href=') === false) {
                $value = str_replace("<p>", "", $value);
                $value = str_replace("</p>", "", $value);
                return '<p><a href="'.$value.'" target="_blank">'.$value.'</a></p>';
            }
        }

    Cheers

    Plugin Author Miguel López

    (@atallos)

    Have you tried the FAQ

    Can I modify how the fields value are showned?
    Yes, you can, since version 1.5.4, I have added a filter called “bxcft_show_field_value”. You can use it and modify the value of your fields. For example, if you need to show only the day or month of the birthdate you need to add this code below in the functions.php of your theme:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
        $value_to_return = $value;
        if ($value_to_return == '')
            return $value_to_return;
        $value_to_return = $value;
        if ($type == 'birthdate') {
            $value = str_replace("<p>", "", $value);
            $value = str_replace("</p>", "", $value);
            $field = new BP_XProfile_Field($id);
            // Get children.
            $childs = $field->get_children();
            $show_age = false;
            if (isset($childs) && $childs && count($childs) > 0) {
                // Get the name of custom post type.
                if ($childs[0]->name == 'show_age')
                    $show_age = true;
            }
            if ($show_age) {
                return '<p>'.floor((time() - strtotime($value))/31556926).'</p>';
            }
            return '<p>'.date_i18n( 'F j' , strtotime($value) ).'</p>';
        }
        return $value_to_return;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘target="_blank" for website addresses’ is closed to new replies.