WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Adding shortcode each time php loops

[Resolved] Adding shortcode each time php loops

  • Hi,

    I am currently trying to display a shortcode box each time a php loop runs. This box will contain various images and text selected by the query.

    Extremely new to WP and looking for some advice.

    Current code:

    [php]
    $imageQuery = "SELECT * FROM X WHERE City LIKE 'City' ORDER BY CityCode";
    $result = mysql_query($imageQuery) or die(mysql_error());
    
    while( $row=mysql_fetch_row($result) )
    {
    echo do_shortcode[styledbox type="general shaded"  ].$row[1].[/styledbox];
    
    }
    [/php]

    Essentially a query that i am looking to create a new box each time it runs, with field information displayed relating to the row the loop is on, forming a list of boxes.

    Any help much appreciated,

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Adding shortcode each time php loops’ is closed to new replies.