WordPress.org

Forums

WP Super Cache
[resolved] WP Super Cache & dynamic header in twenty eleven theme (2 posts)

  1. t0m_ka
    Member
    Posted 2 years ago #

    Before the topic is closed w/o a solution again...
    I know this is not the first time this question is asked here and the suggested solution was always to read the readme and how to work with dynamic content.

    I was trying to implement it to the dynamic header in twenty eleven theme but it wont work. any chance to get it running w/o adding java script? Did anyone implement it successfully into the standard theme?

    My try was:

    <header id="branding" role="banner" class="collapsible">
    			<!--dynamic-cached-content--><?php
    				// Check to see if the header image has been removed
    				$header_image = get_header_image();
    				if ( $header_image ) :
    					// Compatibility with versions of WordPress prior to 3.4.
    					if ( function_exists( 'get_custom_header' ) ) {
    						// We need to figure out what the minimum width should be for our featured image.
    						// This result would be the suggested width if the theme were to implement flexible widths.
    						$header_image_width = get_theme_support( 'custom-header', 'width' );
    					} else {
    						$header_image_width = HEADER_IMAGE_WIDTH;
    					}
    					?><!--
                        $header_image = get_header_image();
                        if ( $header_image ) :
                            // Compatibility with versions of WordPress prior to 3.4.
                            if ( function_exists( 'get_custom_header' ) ) {
                                // We need to figure out what the minimum width should be for our featured image.
                                // This result would be the suggested width if the theme were to implement flexible widths.
                                $header_image_width = get_theme_support( 'custom-header', 'width' );
                            } else {
                                $header_image_width = HEADER_IMAGE_WIDTH;
                            }
                        --><!--/dynamic-cached-content-->
    			<!-- <a href="<?php //echo esc_url( home_url( '/' ) ); ?>"> -->
    				<!--dynamic-cached-content--><?php
    					// The header image
    					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
    					if ( is_singular() && has_post_thumbnail( $post->ID ) &&
    							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    							$image[1] >= $header_image_width ) :
    						// Houston, we have a new header image!
    						echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    					else :
    						// Compatibility with versions of WordPress prior to 3.4.
    						//if ( function_exists( 'get_custom_header' ) ) {
    						//	$header_image_width  = get_custom_header()->width;
    						//	$header_image_height = get_custom_header()->height;
    						//} else {
    						//	$header_image_width  = HEADER_IMAGE_WIDTH;
    						//	$header_image_height = HEADER_IMAGE_HEIGHT;
    						//}
    						?><!--
                            if ( is_singular() && has_post_thumbnail( $post->ID ) &&
                                    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
                                    $image[1] >= $header_image_width ) :
                                // Houston, we have a new header image!
                                echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
                            else :
                            --><!--/dynamic-cached-content-->
                        <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    				<?php endif; // end check for featured image or standard header ?>
    			<!-- </a> -->
    			<?php endif; // end check for removed header image ?>
    
    			<!-- #access -->
    	</header><!-- #branding -->

    I'm running out of ideas and endurance to try it any longer... there must be a way, it is a standard theme... any idea?

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. t0m_ka
    Member
    Posted 2 years ago #

    Thanks.
    using Total Cache now and it works out of the box.

    Was a fan of super cache, but was unable to manage this problem without any help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic