-4

I'm attempting to put a slider on every page within a theme, however, I wish to change a single page to have a different slider alias for alternative content. the php validator I'm using gives me an unexpected 'echo' (T_ECHO) on line 3. I'm not sure why that is as my understanding of any code is limited. Any help is appreciated.

<?php
        if (is_page ('145') {
                    echo do_shortcode ('[rev_slider alias='hp']');
        } else {
                    echo do_shortcode ('[rev_slider alias='main']')
        }
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95

2 Answers2

1

Try this

 if (is_page ('145') {
                        echo do_shortcode ("[rev_slider alias='hp']");
            } else {
                        echo do_shortcode ("[rev_slider alias='main']")
            }
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • You've tried to use the comments to fix the problems but have missed certain comments. – Script47 Jul 12 '18 at 10:30
  • we both put the solution same time, even after i see that comment i review as useful. i don't care about your review. – Rahul Kalal Jul 12 '18 at 10:32
  • 1
    You have misunderstood my comment, you answer is still incorrect. You have syntax errors, no need to get so worked up. – Script47 Jul 12 '18 at 10:33
0

Your code has many small mistakes. It should be like:-

<?php
    if (is_page ('145')) {
        echo do_shortcode ('[rev_slider alias="hp"]');
    } else {
        echo do_shortcode ('[rev_slider alias="main"]');
    }
?>
GluePear
  • 7,244
  • 20
  • 67
  • 120