WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Template in Shortcode does not work

[Resolved] Template in Shortcode does not work

  • Hi,

    the usage of [wp-tiles template=”Plain”] (and any other template) seems not to work. Here are my investigations:

    – wrong script is outputed: "rowTemplates":{"0":[" . . . . . "],"small":[" A A "," . . "," A A "," . . "," A A "," . . "," A A "]}
    I think this have to be strings not arrays (if choosing no template, there are strings not arrays)
    – I have looked at wp-tiles.php. The issue seems to be somewhere around here:

    if ( ! empty ( $atts['template'] ) && ! empty ( $atts['templates']['templates'][ $atts['template'] ] ) ) {
    	$templates = array ( $atts['templates']['templates'][ $atts['template'] ] );
    } else {
    	$templates = $atts['templates']['templates'];
    }
    
    foreach ( $templates as &$template ) {
    	$template = explode ( "\n", $template );
    }

    Finally, I could not fix it. Could You fix it please?

    By the way, PHPStorm shows some PHP validation errors that should be fixed too.

    Greets
    Raubvogel

    http://wordpress.org/extend/plugins/wp-tiles/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mike Martel

    @mike_cowobo

    Hi Raubvogel,

    thanks for your comment and energy put in checking the plugin! Unfortunately I think your problem lies elsewhere, as it actually should output an array. Here’s my dump of the rowTemplates without ‘template’:

    rowTemplates:  object(5): {
             0:  array(4): {
                [0]:  string(12): " . A A B B D"
                [1]:  string(12): " . A A C C D"
                [2]:  string(12): " E E G G . ."
                [3]:  string(12): " F F G G . ."
             }
             1:  array(4): {
                [0]:  string(11): " A . B . C "
                [1]:  string(11): " A . B . C "
                [2]:  string(11): " . D . E . "
                [3]:  string(11): " . D . E . "
             }
             2:  array(6): {
                [0]:  string(3): "A A"
                [1]:  string(3): ". ."
                [2]:  string(3): "B B"
                [3]:  string(3): ". ."
                [4]:  string(3): "C C"
                [5]:  string(3): ". ."
             }
             3:  array(1): {
                [0]:  string(5): ". . ."
             }
             small:  array(7): {
                [0]:  string(4): ". . "
                [1]:  string(3): "A A"
                [2]:  string(3): ". ."
                [3]:  string(3): "B B"
                [4]:  string(3): ". ."
                [5]:  string(3): "C C"
                [6]:  string(3): ". ."
             }
          }

    and here with template (number 3 in the above example):

    rowTemplates:  object(2): {
             0:  array(1): {
                [0]:  string(5): ". . ."
             }
             small:  array(7): {
                [0]:  string(4): ". . "
                [1]:  string(3): "A A"
                [2]:  string(3): ". ."
                [3]:  string(3): "B B"
                [4]:  string(3): ". ."
                [5]:  string(3): "C C"
                [6]:  string(3): ". ."
             }
          }

    as you can see, they’re the same.

    So perhaps something else is going on. What happens exactly when you use a pre-set template?

    Also, what’s the width of the content div the tiles are displayed in? If it’s less than 800px wide, you’re probably seeing the small screen template when you pre-set a template. I will fix this bug in the next version. ( See the thread from yesterday )

    Cheers,
    Mike

    Hi, Mike,

    OMG, You are right. The container has a width of 799px … Increasing this size fixes the problem. Thanks for Your help!

    Cheers,
    Raubvogel

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Template in Shortcode does not work’ is closed to new replies.