Modal image default On

Posted in: Newspaper
Post count: 39

Is there any quick fix to make Modal image default On ?

Right now is set to Off and I have to click a lot of images to set them to On.

Post count: 388

This has been asked a couple of times recently, so you’re not alone. (I would love something like that too.) TagDiv has said that they’ll add it to their feature requests list and consider it for a future update.

Post count: 39

Well, in the meanwhile I could change some code to make Modal images Default On.
..but which template file is that?

Post count: 39

I think the function that handles that, is function td_change_backbone_js_hook() in functions.php

Post count: 6600

Hi,

Like TheMediumUTM wrote we have this on our features request list, unfortunately we are still searching for a better implementation for this and it’s not an easy task, fell free to change it yourself if you want but we cannot offer custom work so we can’t help you at the moment and you will have to hire a developer to help you with this if you don’t know how to do it.
Until we improve this you can try to use a plugin for this.

Sorry for the inconvenience and thanks for the message!

Post count: 317

@Lucian: As far as I am concerned, most of the users of Newspaper would love to use the feature. You see, it isn’t a “custom work”. It should be On all the time cause it is just too much annoying to turn it on for every image.

Please add this feature. It should be your #1 feature to do on the next version.

Post count: 39

You are absolutely right @mehedi.

I just finished clicking 14 times on 14 images in a post, I just published.
Very time consuming.

Post count: 6600

Hi,

Thanks for your suggestions, we have this on our todo list and will try to implement it as soon as possible, this is not an easy task so we can’t offer an ETA for this.

Sorry for this.
Thanks for the message!

Post count: 13

We fixed it using this:

jQuery( document ).ready( function ($) {

if ( $( document.body ).hasClass( 'single' ) ) {

$( '.td-post-text-content figure > a img' ).addClass( 'td-modal-image' ) ;

}

} ) ;

Post count: 6600

Thanks for sharing!
Have a nice day!

Post count: 102

Add me to the list of people who wants this on by default. I didn’t realize it at first so I had to go back and fix this for dozens of posts!


@historiek
Where do I insert this code?

Post count: 13

@ned4spd8874

You should create a small .js-file with the code above and place it in a folder (like js or something). After that you’ll have to activate the script in functions.php. Like:

// include theme.js
//
wp_enqueue_script( 'theme-js', get_stylesheet_directory_uri() . '/js/theme.js', array( 'jquery'), NULL, TRUE );

Post count: 102

Thanks @historiek for the help. However, I have thousands of posts, so I would have to go through every single one to fix this? This is a major issue and should be moved up to a high priority bug, or missing essential feature.

Post count: 13

@ned4spd8874 We have thousands of posts af well. We’re using the code and all WP-images now automatically get ‘modal on’. You don’t have to through every single post. Doing that wasn’t an option for us as well. That’s why we created the code.

Post count: 102

Thanks again @historiek! Sorry it’s taken me so long to reply back. Been a busy holiday season and I’ve been traveling.

I’ve tried to implement this, but I still can’t get it working. I’ve tried putting it in both the child and regular theme functions.php, but neither seem to work. I’ve flushed cache, etc., but I just can’t get it working. Any ideas?

Post count: 13

It should work when you follow these steps:

1) Place this code in functions.php

// include theme.js
//
wp_enqueue_script( 'theme-js', get_stylesheet_directory_uri() . '/js/theme.js', array( 'jquery'), NULL, TRUE );

2) Create a theme.js-file with this code:

jQuery( document ).ready( function ($) {

if ( $( document.body ).hasClass( 'single' ) ) {

$( '.td-post-text-content figure > a img' ).addClass( 'td-modal-image' ) ;

}

} ) ;

3) Upload theme.js to the specified folder (i.e.: wp-content/themes/Newspaper/js/)

That’s all.

Post count: 102

@historiek, I thought I had it. I put in the root of WordPress and not the theme. I moved it to the folder mentioned above (wp-content/themes/Newspaper/js/), but still can’t get it working. I’ve quadruple checked, and I’ve followed your steps, but it just won’t work for me.

My site is AfterCredits.com, do you have any ideas on why this wouldn’t be working?

Post count: 13

Maybe it has something to dot with a child-theme.

In which functions.php did you add the code? In the one in folder ‘Newspaper’ or folder ‘Newspaper-child’?

Post count: 102

I’ve tried both but get an error when I try to put it in the child theme (Warning: Division by zero in /home/content/xxx/html/wp-content/themes/Newspaper-child/functions.php on line 5) I also even put the js file in both locations. So now the js file is in both child and parent but the code is only in the parent functions.php file.

BTW: I’ve manually set it on recent files so if you’re looking, you’ll have to find an older post (ex. http://aftercredits.com/2014/07/howard-duck-1986/)

Post count: 6600

Hi,

I have also tested this using the main theme, altered a bit the code provided by @historiek like this: http://screencast.com/t/SG7aq7X0
Create the file like @historiek instructed above then add this code into it: http://pastebin.com/d2rVkszD
Check the page source to see if the script is loaded: http://screencast.com/t/wCsTvUYs
The modal view should be added to all images within post content which don’t have caption.
Make sure you check your browser’s console to see if you have any js errors in there. If you have make sure you disable all plugin leaving just VC active, empty cache and try again.
Hope this helps!

Thanks

Post count: 13

Thanks for diving in this Lucian. It’s working on our site as well.

Post count: 102

@Lucian, it must be the child theme that’s doing it then. I’ve verified what you said, but it’s still not working. This NEEDS to be a feature of this theme. If I have to go back through all my posts then I better get compensated for my time due to this lack of functionality.

Post count: 54

It’s NOT working on our site !!!!!

All Image could not be loaded .

http://prntscr.com/5sorai

I disable all plugin leaving just VC active, empty cache and it’s the same < what can i do ?
site : http://goo.gl/Ns3fC1

  • This reply was modified 11 years by iha.
  • This reply was modified 11 years by iha.
Post count: 6600

Hi,


@ned4spd8874
Please make sure that you don’t use caption for you images and send me your site’s URL so I can check.

@iha
You need to have your image to link to media: http://screencast.com/t/9dJcfGM0z

Thanks

Post count: 102

Thanks @Lucian, I don’t use captioning. Here’s an example post on my site: http://aftercredits.com/2014/07/howard-duck-1986/

Viewing 25 posts - 1 through 25 (of 39 total)
You must be logged in to reply to this topic.