WordPress.org

Ready to get started?Download WordPress

Forums

WP Tiles
[resolved] Template in Shortcode does not work (3 posts)

  1. raubvogel
    Member
    Posted 1 year ago #

    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/

  2. Mike
    Member
    Plugin Author

    Posted 1 year ago #

    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

  3. raubvogel
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.