Repeat visitors not seeing header change

Community Forums Forums General Discussion Repeat visitors not seeing header change

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  John 9 months, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #66150

    RichardNJ
    Participant
    Post count: 21

    I recently updated my header banner, and it appears that repeat visitors to my site can not see the change unless they clear their browser cache. Is there a way to force the refresh when a repeat visitor comes to our site, so that they can see certain updates like the header banner that are apparently saved in the cache.

    Thanks for any guidance or thoughts.

    http://www.ItaliaLiving.com
    #66277

    RichardNJ
    Participant
    Post count: 21

    I see there is a line of code in the style.php file that says:

    function ntg_theme_settings_style_box() {
    // set the default selection (if empty)
    $style = genesis_get_option(‘style_selection’) ? genesis_get_option(‘style_selection’) : ‘style.css’;
    ?>

    I was doing some googling and some people on other sites seem to suggest if you add a version number like: “?v=2″ to the end of the file, that it would force the browser to load the current stylesheet.

    Does anyone have experience with doing this? I am always afraid to touch any coding. Since I changed my header banner, I just need the new updated one to load when repeat visitors come to my site.

    Thanks for any help!

    #66335

    John
    Participant
    Post count: 155

    Hey Richard,

    Ironically I was just dealing with this issue myself on some of my client sites, and worked out a solution earlier this week that I explain in this blog post (published today): Force browser cache to reload CSS: Genesis, WordPress, W3 Total Cache

    John


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #66355

    RichardNJ
    Participant
    Post count: 21

    Hey John,

    Thanks so much for your reply on this. Great blog post…although most of it is over my head…I’m trying best I can to understand. Not good with the technical back end of these things. Your plugin looks great and I’d like to try it…only bit hesitant because I had installed another cache plugin in the past, and my host (lunarpages) had warned me that I was using excessive resources on the server and suggested I remove any cache plugins…I did so and they said I was back to normal usage. Again, not being technically savvy…I don’t know why that would have had an effect.

    In any case, I’m using the Lifestyle theme and Genesis and basically from what I’ve read, if I add something like:
    ‘style.css’; ?ver=2>
    that should work?

    • This reply was modified 9 months, 1 week ago by  RichardNJ.
    • This reply was modified 9 months, 1 week ago by  RichardNJ.
    #66361

    John
    Participant
    Post count: 155

    Richard,

    W3 Total Cache isn’t my plugin – I just use and recommend it. That’s a strange request from your host…normally a caching plugin will or should greatly reduce using resources on a server. Perhaps the caching plugin you were using had some problems.

    Anyhow, the summary of my blog post was that you need to edit your functions.php file to properly add a new version number to your style.css. In fact, the way Genesis works, I’m pretty sure that’s the only way you’d be able to do it without doing some serious hacking.

    It looks like you’re using the original Lifestyle theme and not Lifestyle Pro, so you’d need to look in your functions.php file for this code:

    
    /** Child theme (do not remove) */
    define( 'CHILD_THEME_NAME', 'Lifestyle Theme' );
    define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/lifestyle' );
    

    and add this line after that:

    
    define( 'CHILD_THEME_VERSION', '2.0.20131011' );
    

    I added the date to the version number, which is what I recommended in my blog post, but it could be anything as long as it’s different than 2.0.1, which is what Genesis is currently adding to your style.css file name.

    John


    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

    #66499

    RichardNJ
    Participant
    Post count: 21

    John,

    I don’t have any code that resembles that in my functions.php file. I have this below, so I’m clueless on where to add that define line you suggest.

    -Richard

    <?php 
    // Start the engine
    require_once(TEMPLATEPATH.'/lib/init.php');
    require(CHILD_DIR.'/style.php'); 
    
    add_theme_support( 'genesis-connect-woocommerce' );
    
    // Add new image sizes
    genesis_add_image_size('Mini Square', 70, 70, TRUE);
    genesis_add_image_size('Square', 110, 110, TRUE);
    
    // Force layout on homepage
    add_filter('genesis_options', 'lifestyle_home_layout', 10, 2);
    function lifestyle_home_layout($options, $setting) {
    	if($setting == GENESIS_SETTINGS_FIELD) {
    		if(is_home())
    		$options['site_layout'] = 'content-sidebar';
    	}
    	return $options;
    }
    
    add_action('genesis_header', 'italia_top_nav', 1);
    function italia_top_nav() { ?>
    	<div id="topnavbar">
    
    		<div class="topnavbarleft">
    			<p><?php echo date("l, F j, Y"); ?></p>
    		</div>
    
    		<div class="topnavbarright">
    			<a class="rsslink" rel="nofollow" href="<?php bloginfo('rss_url'); ?>"><?php _e("News Feed", 'studiopress'); ?></a>
    		</div>
    
    	</div>
    <?php }
    
    // Add Google AdSense after single post
    add_action('genesis_after_post_content', 'lifestyle_include_adsense', 9); 
    function lifestyle_include_adsense() {
        if(is_single())
        require(CHILD_DIR.'/adsense.php');
    }
    
    // Add two sidebars to the main sidebar area
    add_action('genesis_after_sidebar_widget_area', 'lifestyle_include_bottom_sidebars'); 
    function lifestyle_include_bottom_sidebars() {
        require(CHILD_DIR.'/sidebar-bottom.php');
    }
    
    // Register sidebars
    genesis_register_sidebar(array(
    	'name'=>'Sidebar Bottom Left',
    	'description' => 'This is the bottom left column in the sidebar.',
    	'before_title'=>'<h4 class="widgettitle">','after_title'=>'</h4>'
    ));
    genesis_register_sidebar(array(
    	'name'=>'Sidebar Bottom Right',
    	'description' => 'This is the bottom right column in the sidebar.',
    	'before_title'=>'<h4 class="widgettitle">','after_title'=>'</h4>'
    ));
    genesis_register_sidebar(array(
    	'name'=>'Featured Top Left',
    	'description' => 'This is the featured top left column of the homepage.',
    	'before_title'=>'<h4 class="widgettitle">','after_title'=>'</h4>'
    ));
    genesis_register_sidebar(array(
    	'name'=>'Featured Top Right',
    	'description' => 'This is the featured top right column of the homepage.',
    	'before_title'=>'<h4 class="widgettitle">','after_title'=>'</h4>'
    ));
    genesis_register_sidebar(array(
    	'name'=>'Featured Bottom',
    	'description' => 'This is the featured bottom section of the homepage.',
    	'before_title'=>'<h4 class="widgettitle">','after_title'=>'</h4>'
    ));
    function my_child_theme_group_filter( $settings, $component ) {
    if( 'groups' == $component ) {
    $settings['show_create'] = is_super_admin();
    }
    return $settings;
    }
    add_filter( 'gconnect_directory_title','my_child_theme_group_filter', 10, 2 );
    /** Add support for 1-column footer widgets **/
    add_theme_support( 'genesis-footer-widgets', 1 );
    /** Add support for 1-column footer widgets **/
    add_theme_support( 'genesis-footer-widgets', 1 );
    ?>
    #66503

    John
    Participant
    Post count: 155

    Interesting. Are you using version 1 of that theme?

    Regardless of what version it is, you can add the line anywhere before the final ?>

    To be more specific, add it after this line in your code:

    
    add_theme_support( 'genesis-connect-woocommerce' );
    

    John Sundberg | blackhillswebworks.com
    A WordPress developer’s toolbox: Firebug | WordPress Codex | Google ;)

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.