• Resolved sundance7

    (@sundance7)


    This is a nice plugin but I am having a problem getting it to print images using the Virtue theme. I tested it on other themes and it works fine. I deactivated all other plugins and it still will not print images. All I get is the title of the image. The rest of the page is blank. I read the other posts that sound similar and tried setting the “Pause before print” to 20000 but still no luck. Let me know if you need to see it. The site is password protected. Thanks for the help!

    https://wordpress.org/plugins/print-o-matic/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Baden

    (@baden03)

    Link would be helpful.
    But it sounds like your images are not using full URLs, but rather relative urls.

    Thread Starter sundance7

    (@sundance7)

    Thanks for the quick response! I tried using the full url but no luck. I have disabled the password protection so you can get a better look. http://www.wjhstudio.com/cheslyn-community-information
    Thanks.

    Plugin Author Baden

    (@baden03)

    Ah! ok.. the html your theme is outputting is using the srcset attribute for responsive images. However, these urls are relative. For example:

    <img src="http://www.wjhstudio.com/wp-content/uploads/2016/07/Cheslyn-community-information-sheet.png" alt="Cheslyn-community-information-sheet" width="2351" height="3101" class="aligncenter size-full wp-image-533" srcset="/wp-content/uploads/2016/07/Cheslyn-community-information-sheet.png 2351w, /wp-content/uploads/2016/07/Cheslyn-community-information-sheet-227x300.png 227w, /wp-content/uploads/2016/07/Cheslyn-community-information-sheet-768x1013.png 768w, /wp-content/uploads/2016/07/Cheslyn-community-information-sheet-776x1024.png 776w" sizes="(max-width: 2351px) 100vw, 2351px">

    both the src and the srcset values should be full urls. Do you have both the WordPress Address (URL) and the Site Address (URL) set under Dashboard > Settings > General?

    Thread Starter sundance7

    (@sundance7)

    Thanks again for your help! They are both set to http://www.wjhstudio.com I found a snippet that removes the srcset but this is not an ideal solution but it works. Do you have any other ideas?

    Plugin Author Baden

    (@baden03)

    you say this is only a problem with Virtue theme…
    is this a premium theme? if so, you might open a thread with the theme support and ask what’s up with the relative urls?

    as a plan… where are we… C… well, first are you using a child theme, or the virtue theme directly?

    Thread Starter sundance7

    (@sundance7)

    It is a premium theme. I am using a child theme.

    Plugin Author Baden

    (@baden03)

    ok, then try adding the following to your child-theme’s function.php file:

    /*
     * Force full URLs in srcset attributes
     */
    function full_srcset( $sources ) {
      foreach ( $sources as &$source ) {
        $source['url'] = set_url_scheme( $source['url'], 'http' );
      }
      return $sources;
    }
    add_filter( 'wp_calculate_image_srcset', 'full_srcset' );
    Thread Starter sundance7

    (@sundance7)

    Thanks for your time. Excellent support. It didn’t force full urls.

    Plugin Author Baden

    (@baden03)

    well, here is one way to find out:
    change the function as follows:

    function full_srcset( $sources ) {
      foreach ( $sources as &$source ) {
        //$source['url'] = set_url_scheme( $source['url'], 'http' );
        var_dump($source);
      }
      return $sources;
    }
    add_filter( 'wp_calculate_image_srcset', 'full_srcset' );

    This should dump out what the source is… if it’s correct, then your theme is changing it later… but first let’s verify that the sources are correct at some point.

    Thread Starter sundance7

    (@sundance7)

    This is what i got.
    array(3) { [“url”]=> string(67) “/wp-content/uploads/2016/07/Cheslyn-community-information-sheet.png” [“descriptor”]=> string(1) “w” [“value”]=> int(2351) } array(3) { [“url”]=> string(75) “/wp-content/uploads/2016/07/Cheslyn-community-information-sheet-227×300.png” [“descriptor”]=> string(1) “w” [“value”]=> int(227) } array(3) { [“url”]=> string(76) “/wp-content/uploads/2016/07/Cheslyn-community-information-sheet-768×1013.png” [“descriptor”]=> string(1) “w” [“value”]=> int(768) } array(3) { [“url”]=> string(76) “/wp-content/uploads/2016/07/Cheslyn-community-information-sheet-776×1024.png” [“descriptor”]=> string(1) “w” [“value”]=> int(776) }

    Plugin Author Baden

    (@baden03)

    ok… then here are three options for you:
    1. open a thread with your theme dev. and ask them what’s up with the urls.
    2. upgrade to print-pro-matic and we’ll figure out what this theme is doing and fix it.
    3. finally, you can try the following code. it’s a bit hacky… but it should work:

    function full_srcset( $sources ) {
      foreach ( $sources as &$source ) {
        $source['url'] = site_url($source['url'], 'http');
      }
      return $sources;
    }
    add_filter( 'wp_calculate_image_srcset', 'full_srcset' );

    Let us know if that works!

    Thread Starter sundance7

    (@sundance7)

    Option 3 worked. Thanks for the excellent support!

    Plugin Author Baden

    (@baden03)

    Huzzah! Glad to hear it.
    if you are pleased with the plugin or it’s support, consider leaving a review.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Can't print images – Theme conflict?’ is closed to new replies.