You have a syntax error here :)
var userFeed = new Instafeed({ get: '', tagName: '', clientId: '', limit: var imglimit = <?php echo json_encode($imglimit); ?>;,
So you should change this code block to
var userFeed = new Instafeed({ get: '', tagName: '', clientId: '', limit: <?php echo json_encode($imglimit); ?>, });
In fact, you do not have to encode json here, as this is just a number. But if it was some kind of array or object, yes, you should have encoded it.
And in your php code you have to do $imglimit global:
function theme_customizer() { global $imglimit; $imglimit = get_theme_mod('imglimit'); }
Or just put this in js:
var userFeed = new Instafeed({ get: '', tagName: '', clientId: '', limit: <?php echo json_encode(get_theme_mod('imglimit')); ?>, });
source share