WordPress.org

Ready to get started?Download WordPress

Forums

Arconix Shortcodes
[resolved] Additional attribute for button-Shortcode (3 posts)

  1. hattl
    Member
    Posted 8 months ago #

    Hi,
    i need to add additional code for Google Analytics to the a-Tag. Example <a href="http://link-to-somewhere" onclick="_gaq.push(['_link', this.href]); return false;">touch me</a>

    So i tried to append some code in the file shortcodes.php. But after that, only a white webpage appears. Here is my extended part of the button code, the Attribute ist named mydat:

    function button_shortcode( $atts, $content = null ) {
    $defaults = apply_filters( 'arconix_button_shortcode_args', array(
            'size' => 'medium',
            'color' => 'white',
            'url' => '#',
            'target' => '',
            'rel' => ''
    	'mydat' => ''
        ) );
    	   // Properly escape our data
    	$mydat = esc_attr( $mydat );
    return "<a href='{$url}' '{$mydat}' class='arconix-button arconix-button-{$size} arconix-button-{$color}'{$rel}{$target}>{$content}</a>";
    }

    What can i do?

    http://wordpress.org/plugins/arconix-shortcodes/

  2. John Gardner
    Member
    Plugin Author

    Posted 8 months ago #

    Hi hattl,

    Thanks for using my plugin. A comma should follow every item in an array (optionally on the last item), so assuming nothing else in the function has changed, you're missing a comma after the 'rel' => '' above your mydat.

  3. hattl
    Member
    Posted 8 months ago #

    The missing comma was the solution, all works fine. Thanks a lot for your immediate help.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.