Hi all,

I really like the shortcode project. I have used it to easily make a contact page and to add social links. However, I would like the social links to open in a new window. Is it possible with the shortcode module, or should I implement it manually?

Kind regards,

Comments

denes.szabo’s picture

Status: Active » Closed (works as designed)

I think you can write own shortcode tags you want. If you want open something into a lightbox style modal window, you should use the colorbox_node module. It is easy just add a .colorbox-node class to the link (a tag) then it will open in the colorbox modal.

For opening things in the new window I would add the target attrib to the link, or I would use a special js. But these solutions depend on you and your coded shortcode tag.

flying dutchman’s picture

Thank you for your response.

I accidentally posted it in the wrong queue. It should be in the sc_basic queue, as I was thinking about changing those basic tags. However, I got stuck on it.

joaogarin’s picture

Issue summary: View changes

The shortcode links function is incomplete.

I provide here a solution that fixed it for me, anyu chance to put it into the module? It was missing style,class and all other attributes for a link when doing this :

$attrs = shortcode_attrs(array(
'path' => '',
'title' => '',
// ...etc
), $attrs
);

Where //...etc should be the remaining attributes.

Changed it to :

function shortcode_basic_tags_shortcode_link($attrs, $text) {
$attrs = shortcode_attrs(array(
'path' => '',
'title' => '',
'class' => '',
'style' => '',
'id' => '',
), $attrs
);

$path = url($attrs['path']);

if ($attrs['class'] == '') {
$class = '';
}
else{
$class = $attrs['class'];
}

if ($attrs['style'] == '') {

}
else{
$style = $attrs['style'];
}

if ($attrs['id'] == '') {

}
else{
$id = $attrs['id'];
}

if ($text) {
$class = empty($class) ? '' : ' class="' . $class . '"';
$style = empty($style) ? '' : ' style="' . $style . '"';
$id = empty($id) ? '' : ' id="' . $id . '"';
if ($attrs['title'] == '') {
$title = '';
}
else {
$title = empty($attrs['title']) ? check_plain($text) : check_plain($attrs['title']);
$title = ' title="' . $title . '"';
}
return '' . $text . '';
}
return $path;
}