samedi 12 mai 2018

php if condition not working in wordpress

For the below page: https://www.mousampictures.com/department/wedding/

I am trying to show an slider if the heading matches the provided heading:

    <div id="content" class="site-content" role="main">
        <div class="layout-full">
            <header class="entry-header">
                <h1 class="entry-title"><?php single_cat_title(); ?></h1>
           <!-- This displays 'Wedding' -->
            </header>

            <!-- wedding -->        
            <?php 
                if ( single_cat_title() == "Wedding")  {
//above line doesn't work...and instead prints wedding on the page.
                    echo do_shortcode('[metaslider id="1710"]');
                }
            ?>

            <!--portrait -->
            <?php echo do_shortcode('[metaslider id="1718"]'); ?> 

            <!--travel -->
            <?php echo do_shortcode('[metaslider id="1714"]'); ?>

        </div>

I need to show each slider, depending on the correct page.

Aucun commentaire:

Enregistrer un commentaire