How can I add target=‘_blank’ to this code?
echo '<a href="' . esc_url ( $sociable_link ) . '"><i class="' . $item['icon'] . '"></i></a>';
All help greatly appreciated
How can I add target=‘_blank’ to this code?
echo '<a href="' . esc_url ( $sociable_link ) . '"><i class="' . $item['icon'] . '"></i></a>';
All help greatly appreciated
Like this:
echo '<a href="' . esc_url ( $sociable_link ) . '" target="_blank"><i class="' . $item['icon'] . '"></i></a>';
Use the double quotes to avoid conflicting with the single quotes that PHP is using. The alternative is to use single quotes and escape them with backslashes, but it’s a messier option and not necessary. Better to keep the HTML consistent and use double quotes for this, as you’re doing with the href value.
Thank you Thank you ralpm, such a speedy helpful reply, yes working perfectly
Thank you again
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.