WordPress.org

Ready to get started?Download WordPress

Forums

WP jQuery Lightbox
the_excerpt() and the lightbox filter (6 posts)

  1. Frumph
    Member
    Posted 3 years ago #

    You cannot add the filter to the_excerpt() it needs to be removed

    // add_filter('the_excerpt', 'jqlb_autoexpand_rel_wlightbox', 99);

    1. The excerpt gets filters of html images to begin with, there's no reason for it.

    2. When themes utilize get_the_excerpt() for things like meta descriptions (or SEO plugins) your

    return "\n<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> \n" . $content;

    destroys the output.

    http://wordpress.org/extend/plugins/wp-jquery-lightbox/

  2. ulfben
    Member
    Plugin Author

    Posted 3 years ago #

    1. I don't understand what you're saying. What's "filters of HTML images"?

    2. Themes should use WordPress escaping API to avoid breakage. esc_attr() in this case I assume.

    I'd be grateful if you could please state your sources, as I cant find anything verifying your claim that the_excerpt-filter is off limits for content processing.

  3. Frumph
    Member
    Posted 3 years ago #

    Images do not get passed through the_excerpt(), therefor the lightbox is not needed to be parsed with your plugin.

  4. ulfben
    Member
    Plugin Author

    Posted 3 years ago #

    Galleries might not be passed through but users can specify an explicit excerpt for any posts. Explicit excerpts can contain HTML and thus - images.

    I'm not saying I can see a use case for images in excerpts, but I'm pretty sure there's no harm done in filtering it.

    And then again; if a user goes through the pain of writing their own excerpts they might as well add the necessary rel-attributes to their tags too. The filter is removed in the next release.

    Thanks for bringing it to my attention.

  5. Frumph
    Member
    Posted 3 years ago #

    It really wouldn't be an issue if you moved your <!-- comment to another location; its the comment itself that is the issue not the parsing of it.

    I don't mind the comment, people put them in all the time, it's just that one location which causes issues

    maybe hook it into the wp_footer or wp_head instead so that it only is in the page once instead of every post that it parses

  6. ulfben
    Member
    Plugin Author

    Posted 3 years ago #

    Agreed.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic