Community Forums › Forums › Archived Forums › Design Tips and Tricks › Filter outputting apostrophes in unicode characters
Tagged: filter
- This topic has 3 replies, 2 voices, and was last updated 10 years, 1 month ago by
Victor Font.
-
AuthorPosts
-
November 9, 2015 at 2:47 pm #170593
cultivardesigns
MemberI can't seem to find a way to fix my filter code below
add_filter( 'genesis_attr_body', 'themeprefix_add_attr' ); function themeprefix_add_attr( $attributes ) { $attributes['onload'] = "_googWcmGet('number' '1-555-555-2086')"; return $attributes; }is outputting
<body class="page page-id-483 page-template" itemscope itemtype="http://schema.org/WebPage" onload="_googWcmGet(\'number\' \'1-555-555-2086\')">instead of onload="_googWcmGet('number', '1-555-555-2086')"
Ask us about Custom Genesis WordPress Themes
November 9, 2015 at 3:30 pm #170600cultivardesigns
Memberfunction themeprefix_add_attr( $attributes ) { $attributes['onload'] = '_googWcmGet(\'number\' \'1-555-555-2086\')'; return $attributes; };I tried escaping them with backslashes and it didn't work either.
& # 3 0 9 i is still being outputted in the source.
Ask us about Custom Genesis WordPress Themes
November 10, 2015 at 4:17 am #170638Victor Font
ModeratorI suggest you install the Genesis Simple Hooks plugin and install the script in the site's header. Or as an alternative, create a custom header.php in your child theme's root directory. The code below is an example of header.php I created in my test environment. Your number is already installed.
<?php /** * Genesis Framework. * * * @package Copied from Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ do_action( 'genesis_doctype' ); do_action( 'genesis_title' ); do_action( 'genesis_meta' ); wp_head(); //* we need this for plugins ?> </head> <?php genesis_markup( array( 'html5' => '<body %s onload="_googWcmGet(\'number\', \'1-555-555-2086\')">', 'xhtml' => sprintf( '<body class="%s">', implode( ' ', get_body_class() ) ), 'context' => 'body', ) ); do_action( 'genesis_before' ); genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="wrap">', 'context' => 'site-container', ) ); do_action( 'genesis_before_header' ); do_action( 'genesis_header' ); do_action( 'genesis_after_header' ); genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="inner">', 'context' => 'site-inner', ) ); genesis_structural_wrap( 'site-inner' );
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?November 10, 2015 at 7:10 am #170639Victor Font
ModeratorIf you would like further details, here's an article I wrote for the occasion: http://victorfont.com/adwords-call-tracking-for-genesis-themes/. The article covers what's been discussed above as well as a method using JavaScript.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.