• Resolved hupe13

    (@hupe13)


    Hello Sayontan,

    I’m using your plugin for non-photonic images also with a custom shortcode [photonic]. With the version 2.76 this doesn’t work, I need to write [photonic style="square"].
    Can you this fix please?

    Thank you very much.

    P.S. If I should use [photonic style="square"], then the documentation is not clear.

    If you are using the gallery shortcode put in [gallery style='square']
    If you are using a custom shortcode from the first option on this page, e.g. photonic put in [photonic]

    But if so, I need to change many pages.

    • This topic was modified 2 years, 7 months ago by hupe13.
    • This topic was modified 2 years, 7 months ago by hupe13.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hupe13

    (@hupe13)

    Respectively I can neither access nor edit the pages

    Fatal error: Uncaught Error: array_merge(): Argument #2 must be of type array, string given
    in …/wp-content/plugins/photonic/Core/Photonic.php on line 566

    I’m using php 8, with 7.4 it works.

    • This reply was modified 2 years, 7 months ago by hupe13.
    Thread Starter hupe13

    (@hupe13)

    Temporary solution (php 8):

    add_filter('pre_do_shortcode_tag', function ( $output, $shortcode, $attr ) {
      if ( 'photonic' == $shortcode ) {
        if ($attr == "" ) {
          do_shortcode('[photonic style="square"]');
          return '';
        }
      }
    return $output; }, 10, 3);
    • This reply was modified 2 years, 7 months ago by hupe13.
    Plugin Author Sayontan Sinha

    (@sayontan)

    Unfortunately I always forget to test this scenario.

    The main reason for the problem is that I changed a comparison. In the original code I had this in line 472 of Core/Photonic.php:

    if ($attr == null) {
    	$attr = [];
    }

    I changed it to this:

    if (null === $attr) {
    	$attr = [];
    }

    The switch from == to === triggered the error.

    This works:

    if (empty($attr)) {
    	$attr = [];
    }

    I will patch this soon.

    Thread Starter hupe13

    (@hupe13)

    Unfortunately I always forget to test this scenario.

    Yes, I also know that. ??

    I will patch this soon.

    Thank you very much, it works now!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘photonic for non-photonic images’ is closed to new replies.