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.
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!
@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.
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?
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 );
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.
@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.
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?
-
This reply was modified 11 years by
ned4spd8874.
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.
@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?
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/)
-
This reply was modified 11 years by
ned4spd8874.
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
@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.
It’s NOT working on our site !!!!!
All Image could not be loaded .
I disable all plugin leaving just VC active, empty cache and it’s the same < what can i do ?
site : http://goo.gl/Ns3fC1
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
Thanks @Lucian, I don’t use captioning. Here’s an example post on my site: http://aftercredits.com/2014/07/howard-duck-1986/
