Tuesday, January 29, 2019

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

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...