Sedang Disiapkan

Edit theme coding for button to add Google Analytics onclick

We are using a theme which uses buttons to link to order forms. We need to add an onclick action so that we can track the sales using google analytics.

This should be a very simple and very quick job for anyone who knows how to edit wordpress themes.

Here is the coding used for the button:

Here is the entire section of coding for the button area:

add_shortcode('et_lb_pricing_table', 'et_lb_pricing_table');

function et_lb_pricing_table($atts, $content = null) {

extract(shortcode_atts(array(

'heading' => '',

'price' => '',

'old_price' => '',

'button_text' => '',

'button_url' => '#',

'button_color' => 'blue'

), $atts));

$attributes = et_lb_get_attributes( $atts, "et_lb_pricing_table" );

$output = "<div {$attributes['class']}{$attributes['inline_styles']}>

<div class='et_lb_module_content'>

<div class='et_lb_module_content_inner clearfix'>

<h3 class='et_lb_pricing_title'>{$heading}</h3>

<div class='et_lb_pricing_content'>"

. do_shortcode( et_lb_fix_shortcodes($content) ) .

( '' != $old_price ? "<span class='et_lb_old_price'>{$old_price}</span>" : '' ) .

( '' != $price ? "<span class='et_lb_price'>{$price}</span>" : '' ) .

" </div> <!-- end .et_lb_pricing_content -->

</div> <!-- end .et_lb_module_content_inner -->"

. ( '' != $button_text ? do_shortcode( "[et_lb_button size='medium' align='center' url='" . esc_url( $button_url ) . "' color='{$button_color}']{$button_text}[/et_lb_button]" ) : '' ) .

"</div> <!-- end .et_lb_module_content -->

</div> <!-- end .et_lb_button -->";

return $output;

}

However, you should only need to edit one line to add an onclick action which should be this line:

( '' != $button_text ? do_shortcode( "[et_lb_button size='medium' align='center' url='" . esc_url( $button_url ) . "' color='{$button_color}']{$button_text}[/et_lb_button]" ) : '' ) .

We need it so that the link outputs like this: <a href="[url removed, login to view];pid=1" onclick="[url removed, login to view](['_link', '[url removed, login to view]']);return false;">

Presently the link outputs like this: <a href="[url removed, login to view];pid=1">

The problem we have had in the past is the use of [ and ] which are used within the coding for the button as well as the coding for google analytics. This causes the button code to end early and spill coding onto the screen.

The theme we are using is Convertable by ElegantThemes. I can provide you with the full theme if you need to test it as well as access to the site we are using it on so that you can test it live.

Kemahiran: Google Analytics

Lihat lebih lanjut: line coding, job edit, need quick code wordpress, google job cart, edit job, coding we, coding job, theme sales, test center, live action, google forms, anyone edit, extract wordpress theme, live edit wordpress theme, div screen, extract theme wordpress, wordpress medium, edit cart, wordpress theme medium, attributes amp, medium theme, google problem, medium wordpress, screen coding, wordpress medium theme

Tentang Majikan:
( 4 ulasan ) Las Pinas, Philippines

ID Projek: #1526537

Dianugerahkan kepada:

myabid786

We are a big team. and we are ready to do. send me details........... we want to work with u. check only my skill and experience. 2004 TO 2011 SNGPL Faisalabad CCNB Software Operator & Sectional In charge Doing M Lagi

$35 USD dalam 3 hari
(1 Ulasan)
0.0