I’m working on a WordPress theme and I have come across a little block. I have a small app within the theme that highlights a person’s name when you click on it:


    <script type="text/javascript">
        $(".testimonial-person").click(function() {
            $(".testimonial-person").css( "background", "none");
            var tID = this.id;
            $("#" + tID).css( "background", "url('images/halftone.png') #DDD");
            $("#box-" + tID).delay(102).fadeIn(100);

The issue is that the css() line that shows a background image, that background image is actually a dynamic value - something that would look like this:

$("#" + tID).css( "background", "url('<?php bloginfo('stylesheet_url'); ?>/images/halftone.png' #DDD");

See how the quote marks contradict each other? Does anyone know a way around this, OR a better way to call the image in WordPress?

Read more here: Inserting PHP into jQuery css()


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: