[resolved] How to display sliding images on website home page? (7 posts)

  1. Tanaji
    Posted 2 years ago #

    I used a plugin for upload images, that also have one line code just put into theme page (s) and image gallery/ sliding images display, but I don't like there display style and format, so I used my own display format. Its working fine, but just a expert or using your experience give me advice or suggestions it is correct or not (see the below code). And one think, is it any issues about the performance or website security?

    <?php $sql=mysql_query("select * from table_name");
    { ?>
    Here my own display format like <div>, class, font etc.
    <?php } ?>

  2. Interacting with the database can be both tricky, and risky. It's recommended to keep with the WP syntax...

    Something like:

    $myrows = $wpdb->get_results( "SELECT id, name FROM mytable" );

    Then, I usually "wrap" the results in a foreach loop:

    $myrows = $wpdb->get_results( "SELECT id, name FROM mytable" );
    foreach ($myrows as $myrow) (
       // Do something

    This keeps everything inside the WP classes.. and minimizes instabilities and incompatibilities.

  3. Tanaji
    Posted 2 years ago #

    Thank you so much Josh.

  4. You bet!

    Remember also when you modify core files of plugins or themes... the changes will almost certainly be over-written when updating.

    It's recommended to make these types of changes from the safety of a child theme.

  5. Tanaji
    Posted 2 years ago #

    Thanks again Josh

  6. My pleasure.

    (please mark thread as resolved, if resolved, to help others' in the future)

  7. Tanaji
    Posted 2 years ago #

    Thanks and all the best..!

Topic Closed

This topic has been closed to new replies.

About this Topic