Notifications
Clear all

wpForo 1.x.x [Closed] My Photos on forum issue

10 Posts
3 Users
0 Reactions
568 Views
Posts: 91
Topic starter
(@selinahub)
Estimable Member
Joined: 3 years ago

so when ı click photo ıt showıng up wıthout leavıng the site but on my sıte 

ıts goes to 

 

WHY IS THAT BECAUSE OF THE PLUGGING OR WHAT?

9 Replies
dimalifragis
Posts: 2611
(@dimalifragis)
Famed Member
Joined: 5 years ago

For ONE photo you need to add this to your theme's functions or with some other code snippet Wordpress plugin:

add_filter('wpforo_content_after', function( $content ){
	return preg_replace_callback(
        '#<a[^><]*\sclass=[\'\"](?\s[^\'\"]*)?[\'\"][^><]*\shref=[\'\"]([^\"\']+)[\'\"][^><]*>.*?</a>#isu',
        function( $match ){
                $html     = $match[0];
	        $file     = $match[1];
	        $pathinfo = pathinfo( $file );
	        if( wpforo_is_image($pathinfo['extension']) ) {
                $html = sprintf(
                    '<a href="%1$s" target="_blank"><img class="wpforo-default-image-attachment" src="%1$s" alt="%2$s" title="%2$s"></a>',
	                esc_url($file),
	                esc_attr($pathinfo['basename'])
                );
	        }
            return $html;
        },
        $content
    );
}, 11);

 

The above will embed the image in the body of post.

To open as a popup use ARI Soft

https://wordpress.org/plugins/ari-fancy-lightbox/

it is (imho) the best option.

For more than one photos and attachments in each post, you need to buy Advanced attachments plugin, from gvectors.

 

 

3 Replies
(@selinahub)
Joined: 3 years ago

Estimable Member
Posts: 91

@dimalifragis ı have added the code into thems function  but ıt dıdnt work everytıng went blank unfortunatly:(

dimalifragis
(@dimalifragis)
Joined: 5 years ago

Famed Member
Posts: 2611
Posted by: @selinahub

@dimalifragis ı have added the code into thems function  but ıt dıdnt work everytıng went blank unfortunatly:(

Works very well, if you got a blank page that means you didn't add it correctly.

Use a plugin for that if you want:

https://wordpress.org/plugins/code-snippets/

 

(@selinahub)
Joined: 3 years ago

Estimable Member
Posts: 91

@dimalifragis But at least the app is worked its not ı wanted but ıts okey:)

thnk you for the help

 

dimalifragis
Posts: 2611
(@dimalifragis)
Famed Member
Joined: 5 years ago

@robert isn't time to make "script" into wpforo plugin? What do yo think?

4 Replies
Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10587

@dimalifragis ,

The correct topic and the correct script is this, please always use codes from correct sources: https://wpforo.com/community/how-to-and-troubleshooting-2/uploading-and-embedding-images/#post-5212

And this code is used to show images in a topic not to open it as lightbox. if you want to open an image in lightbox you should use some lightbox plugin. We use Simple Lightbox plugin with

dimalifragis
(@dimalifragis)
Joined: 5 years ago

Famed Member
Posts: 2611
Posted by: @robert

@dimalifragis ,

The correct topic and the correct script is this, please always use codes from correct sources: https://wpforo.com/community/how-to-and-troubleshooting-2/uploading-and-embedding-images/#post-5212

And this code is used to show images in a topic not to open it as lightbox. if you want to open an image in lightbox you should use some lightbox plugin. We use Simple Lightbox plugin with

https://wpforo.com/community/how-to-and-troubleshooting-2/images-inline/#post-58901

Not sure why this hostile and irrelevent reply from you.

 

 

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10587

@dimalifragis,

This is not my reply.

I'll ask @chris to remove it. he has provided an old code.

dimalifragis
(@dimalifragis)
Joined: 5 years ago

Famed Member
Posts: 2611
Posted by: @robert

@dimalifragis,

This is not my reply.

I'll ask @chris to remove it. he has provided an old code.

Remove the code that works and put back the code that doesn't !

Ok, no problem.