• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Filter outputting apostrophes in unicode characters

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Filter outputting apostrophes in unicode characters

This topic is: not resolved

Tagged: filter

  • This topic has 3 replies, 2 voices, and was last updated 9 years, 6 months ago by Victor Font.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • November 9, 2015 at 2:47 pm #170593
    cultivardesigns
    Member

    I 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 #170600
    cultivardesigns
    Member
    function 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 #170638
    Victor Font
    Moderator

    I 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 #170639
    Victor Font
    Moderator

    If 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?

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble