Tuesday, 23 January 2018

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

casting - Why wasn&#39;t Tobey Maguire in The Amazing Spider-Man? - Movies &amp; TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...