Generate sidebar depending on height of post

JavaScript is definitely the way to go. Have a look at jQuery’s height() and outerHeight() functions. outerHeight() includes margins and padding, height() doesn’t. To keep this as simple as possible I would render a fixed-height sidebar initially (from WP/PHP) where the height is a sensible estimate of your longest post and then use JavaScript to … Read more

Path to image in js with wp_localize_script [closed]

Aside from the fact that you shouldn’t use get_bloginfo(‘template_url’), but rather get_template_directory_uri() or it’s *_stylesheet_*() equivalent, it’s a JavaScript problem: The localized object shouldn’t be wrapped in quotes: // Wrong url : ‘svg_path.template_url+”/svg/plus.svg”‘, // Right: url : svg_path.template_url + “/svg/plus.svg”, When handling JavaScript, simply use console.log( svg_path ) in your script to see the output … Read more