GD bbPress Attachments
[resolved] rel atribute for slideshow (4 posts)

  1. wallyO
    Posted 4 years ago #

    Hello Milan, thank you for this great plugin.
    I am using it with PrettyPhoto and it is working well.
    I have added the rel attribute of wp-prettyphoto[bbPressAttachment] so that the attachment images show as a gallery.
    This works well, but includes all attachments of all replies to the topic in the slideshow.

    I wanted to know whether the rel attribute could be dynamic so that it became wp-prettyphoto[the ID of post], or wp-prettyphoto[645] for example, so that the attached images of any one reply would be a separate slideshow.


  2. Milan Petrovic
    Plugin Author

    Posted 4 years ago #

    Yes, good idea, I will make changes for this for next version.


  3. wallyO
    Posted 4 years ago #

    That sounds great.
    Here is the code I used to make this work for me.
    To work this requires that in admin the rel attribute is set with the term post_id between square brackets. For example,
    wp-prettyphoto[post_id] => wp-prettyphoto[645]
    lightbox[post_id] => lightbox[645]
    anything[post_id] => anything[645]
    lightbox => lightbox

    At line 507 of gd-bbpress-attachments\gd-bbpress-attachments.php
    Comment out
    // $rel_a = ' rel="'.$this->o["image_thumbnail_rel"].'"';
    Then add immediately below it

    // Store the value that has been entered in the admin rel input
    $rel_value = $this->o["image_thumbnail_rel"];
    //Extract the value, if any, from between the square brackets
    preg_match("/^(.*\[)(.*)(\])/", $rel_value, $find);
    $rel_post_id = trim($find[2]);
    //If the value between square brackets is post_id output the rel attribute with the actual post id
    if($rel_post_id === "post_id") {
    	$rel_a = ' rel="'.trim($find[1]).get_the_ID().trim($find[3]).'"';
    //Or do the original code
    	$rel_a = ' rel="'.$this->o["image_thumbnail_rel"].'"';

    Hope this helps.

  4. wallyO
    Posted 4 years ago #

    Thank you Milan,
    Version 1.5.2 implements this feature request perfectly.
    5 stars from me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • GD bbPress Attachments
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic