Support » Plugin: GD bbPress Attachments » [Plugin: GD bbPress Attachments] rel atribute for slideshow

  • Resolved wallyO


    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Milan Petrovic


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


    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.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: GD bbPress Attachments] rel atribute for slideshow’ is closed to new replies.