Support » Fixing WordPress » Filter needed for two wp gallery modifications

  • The first modification is I need is for the “wp_get_attachment_link” in the gallery shortcode to have $permalink equal to false. Currently the thumbed images are linking to the attachment page; I don’t want that.

    The second modification I need is for the outputted link to contain a “ref” attribute, of course set a given value.

    Any help will be greatly appreciated. 🙂

Viewing 1 replies (of 1 total)
  • This is what I have so far…

    function process_gallery(){
    add_filter('wp_get_attachment_link', 'add_rel', 10, 4);
    function add_rel($link, $size, $id, $permalink=false){
    return preg_replace('/a href/', 'a rel="lightbox" href', $link);

    This solved the 2nd problem, but for some reason I don’t know the 1st issue persist. I am attempting to force “wp_get_attachment_link” $permalink attribute to be false… but it is still returning a link directed to the attachment page instead of the attachment file which is what I want.

    Help on the above matter please.

    SN: The second issue was also able to be solved simply via jQuery, which I may resort back to since it is very useful to differentiate multiple “wp_get_attachment_link” calls…
    $('.blahblah').attr('ref', 'lightroom');

Viewing 1 replies (of 1 total)
  • The topic ‘Filter needed for two wp gallery modifications’ is closed to new replies.