Condition to display a slider on a certain Web page?



  • Hey, everybody, there's a MetaSlider slider, the installation is that the following code should be added on the page, this code is in the header.php:

    <?php echo do_shortcode('[metaslider id="4"]'); ?>
    

    How can you spell out the condition that this code only operate on a certain page?



  • Use the conditional theater.
    For example, if you need to take the slider off only on the main:

    <?php
    if ( is_front_page() ) {
      echo do_shortcode('[metaslider id="4"]');
    }
    ?>
    

    Read the other conditional theories:
    https://wp-kama.ru/id_89/uslovnyie-tegi-v-wp.html
    https://codex.wordpress.org/Conditional_Tags




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2