Wednesday 27 January 2016

javascript - PHP if else condition inside JS file Wordpress theme customizer condition

$('.class1').append( '' );
var button = $('.class1.load-more');


the above is a code from the .js file of WP infinite scroll Wordpress plugin.



Can we somehow put a PHP condition inside a js file:




If( logical condition 1 )  {
$('.class1').append( '' );
var button = $('.class1.load-more');
} elseif( logical condition 2 ) {
$('.class2').append( '' );
var button = $('.class2 .load-more');
}



P.S.: PHP logic should go inside a js file not script<> tags.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...