WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Disappearing featured image selection (9 posts)

  1. mfaulk
    Member
    Posted 11 months ago #

    With W3 Total Cache enabled, I lose the featured image selector on posts, custom post types and pages. As soon as I disable the plugin, it returns. The featured images still work with theme usage while it's enabled, I just can't add or edit them.

    http://wordpress.org/plugins/w3-total-cache/

  2. niklo
    Member
    Posted 11 months ago #

    Same here. Everything works until I activate the w3 total cache.

  3. niklo
    Member
    Posted 11 months ago #

    Okay, I found a solution to this. My theme has a setup where i include a file that contains the featured post - snippet.

    This was in my functions.php:

    require_once('library/featured_post_snippet.php');

    The featured_post_snippet.php contained this:

    if ( function_exists( 'add_theme_support' ) ) {
      add_theme_support( 'post-thumbnails' );
      set_post_thumbnail_size(90, 90, true);
      add_image_size( 'some_size', 1000, 9999, false ); //300 pixels wide (and unlimited height)
    }

    The setup above broke my featured posts when I activated w3 total cache.

    When I moved the exactly same code straight to the functions.php, everything works okay again. Hope this helps, seems like a minor bug in w3 total cache.

  4. mfaulk
    Member
    Posted 11 months ago #

    My theme is based off of Bones, which uses a secondary file for (bones.php) for add_theme_support().

    I'll see if I can move that section over to functions.php without any hiccups.

    Thanks a ton for figuring that out, you just saved me some serious time Niklo.

  5. mfaulk
    Member
    Posted 11 months ago #

    I tried moving that all back to functions.php and it didn't effect anything in terms of the featured image selection reappearing. Thanks for the input though.

  6. niklo
    Member
    Posted 11 months ago #

    I'm using bones too, with the same filestructure, so this should be a solution for you too.

    <?php
    require_once('library/bones.php');
    require_once('library/custom-post-type.php');
    require_once('library/admin.php');
    
    if ( function_exists( 'add_theme_support' ) ) {
      add_theme_support( 'post-thumbnails' );
      set_post_thumbnail_size(90, 90, true);
      add_image_size( 'suuri_vaaka_sixteen_col', 1000, 9999, false ); //300 pixels wide (and unlimited height)
      add_image_size( 'pieni_vaaka_sixteen_col', 622, 9999, false ); //300 pixels wide (and unlimited height)
      add_image_size( 'pieni_vaaka_three_col', 181, 120, true ); //300 pixels wide (and unlimited height)
      add_image_size( 'pieni_vaaka_two_col', 118, 9999, false ); //300 pixels wide (and unlimited height)
      add_image_size( 'pieni_vaaka_two_col_pysty', 118, 168, true ); //300 pixels wide (and unlimited height)
      add_image_size( 'pieni_vaaka_mini', 55, 35, true ); //300 pixels wide (and unlimited height)
      add_image_size( 'pieni_vaaka_mini_pysty', 55, 80, true ); //300 pixels wide (and unlimited height)  
    
      // additional image sizes
      // delete the next line if you do not need additional image sizes
      add_image_size( 'category-thumb', 300, 9999 ); //300 pixels wide (and unlimited height)
    }
    ?>

    My exact code (that works) is above. Please try it, to see if it works for you!

  7. mfaulk
    Member
    Posted 11 months ago #

    Thanks for your assistance niklo, but the same issue remains.

  8. mfaulk
    Member
    Posted 11 months ago #

    Oh, I see what I did different. I have my add_theme_support and add_image_size sections in a function that wasn't registering with the plugin enabled, where as yours is contained in an if statement.

    When I switched to an if statement like yours everything works fine.

    Thanks for your time!

  9. niklo
    Member
    Posted 11 months ago #

    Good to know that you got it fixed!

Reply

You must log in to post.

About this Plugin

About this Topic