Currently I'm trying to get the category description by ID so that I can use it in jQuery.

I'm finding jQuery will only let me use echo $variablename and not the usual echo that can display the category description.

So far my code looks like this:

$powerandchargdesc = category_description(the_category_id(12));

jQuery("#menu").html("<?php echo $powerandchargdesc; ?>");

This doesn't work but hopefully it will give you an idea of what I'm trying to achieve.

Is there a way to get this to a variable so that I can echo it in jQuery? I also need to know how to get the category title and image but at the moment any help with this would be appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.