PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Google web font not loading when using Gravity forms shortcode in header

  1. Hi

    When using

    <?php echo do_shortcode('[gravityform id="2" name="Contact Mini" title="false" description="false"]'); ?>

    the google webfont "Roboto Condensed" does not load on page refresh. I have tried removing the echoed shortcode and the issue is fixed. If you navigate to any page there is no issue, only when refreshing a page you are already on using a refresh button or hitting f5.

    This issue occurs on windows 7 in Chrome v 24.0.1312.57. I can't replicate it in firefox, safari oe ie9

    <!DOCTYPE html>
    <!-- Add browser classes to html tag -->
    <!--[if lt IE 7]>  <html <?php language_attributes(); ?> class="ie ie6 lte9 lte8 lte7"> <![endif]-->
    <!--[if IE 7]>     <html <?php language_attributes(); ?> class="ie ie7 lte9 lte8 lte7"> <![endif]-->
    <!--[if IE 8]>     <html <?php language_attributes(); ?> class="ie ie8 lte9 lte8"> <![endif]-->
    <!--[if IE 9]>     <html <?php language_attributes(); ?> class="ie ie9 lte9"> <![endif]-->
    <!--[if gt IE 9]>  <html <?php language_attributes(); ?>> <![endif]-->
    <!--[if !IE]> <html <?php language_attributes(); ?>> <![endif]-->
    <!--[if lt IE 9]>
    Meta stuff
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php wp_title('');?></title>
    Link stuff
    <link rel="icon" type="image/png" href="<?php echo get_template_directory_uri(); ?>/images/favicon.png"/>
    <link href='' rel='stylesheet' type='text/css'>
    <link href='' rel='stylesheet' type='text/css'>
    <link href='' rel='stylesheet' type='text/css'>
    <link rel="profile" href="" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>"/>
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <!-- Add Wordpress head hook stuff -->
    <?php wp_head();?>
    Start of body
    <body <?php body_class(); ?>>
    	<div class="wrapper-main">
        <div class="header-form">
        	<?php echo do_shortcode('[gravityform id="2" name="Contact Mini" title="false" description="false"]'); ?>
        	<a class="form-tab"></a>
        </div><!-- end header-form -->
        	<header class="header">
            	<div class="utility-bar">
                	<div class="contact-info">
    				if( function_exists('get_field') ) {
    					if( get_field('header_contact_details','options') ) {
    						echo do_shortcode( get_field('header_contact_details','options') );
                	<nav class="nav-utility clearfix"><?php wp_nav_menu( array( 'theme_location' => 'menu-utility', 'container' => '') ); ?></nav>
                </div><!-- end utility-bar -->
            	<div class="header-content">
                	<a class="logo" href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
    				<nav class="nav-main"><?php wp_nav_menu( array( 'theme_location' => 'menu-main', 'container' => '') ); ?></nav>
                </div><!-- end header-content -->
            </header><!-- end header -->

    The font is loaded with css from style.css, rule as follows

    font:300 normal 35px 'Roboto Condensed', Arial, Helvetica, sans-serif; color:#00335F;

    I can give access to the development site if you cn provide an ip to unblock.

    Posted 10 years ago on Tuesday February 19, 2013 | Permalink
  2. What is the URL to the page where this form is embedded?

    When you include a Gravity Form like that, you may need to enqueue the Gravity Forms scripts and styles using gravity_form_enqueue_scripts

    More about embedding a form via function call:

    Finally, there is a JavaScript event gform_page_loaded which is normally used to ensure fonts are loaded after a Gravity Form is reloaded. The example on that page is for Cufon, but the approach would be the same for Google fonts.

    I would start with gravity_form_enqueue_scripts since you are embedding the form outside the loop.

    Posted 10 years ago on Tuesday February 19, 2013 | Permalink