Support » Fixing WordPress » Check if post has gallery

  • CDSanchez


    Is there any way to check if a post has a gallery? I’m using a plugin that adds a jquery thickbox to galleries.. but it loads jQuery and the thickbox scripts on every page even though posts with galleries are the only pages that will use those javascripts. I don’t want my users to download something they might not need during their visit

    I was thinking of doing something like:

    if (do_shortcode('[gallery]')) {
     //load javascripts


    if (!empty(do_shortcode('[gallery]')) {
     //load javascripts

    Would that work? I don’t want to mess with anything and break it inadvertently.

  • The topic ‘Check if post has gallery’ is closed to new replies.