Hey there – I want to allow people to add a video to their business listing, but when they do it autoplays them when someone goes to view the listing – which is really frustrating for many.
is there a css code or a way that I can turn OFF autoplay of videos in all listings (so that it will then show the placeholder image with a play button, but not start automatically)
Unfortunately, there isn’t an easy way that I’m aware of to do this without editing a core file.
Is it possible to tell me in non techy language how to edit the core file – Im using hotel directory child theme – Im quite techy and know how to access files and add code etc but get lost when people use totally techy language to get me there 🙂
Would be a great update to have a toggle on/off option for autoplay or not 🙂
“Is it possible to tell me in non techy language how to edit the core file…”
Don’t really want to get too in-depth… here are a couple images showing a couple things you can change a youtube parameter. This may cover a couple locations, not all. There are other areas where it could still autoplay.
All of the changes have to do with the autoplay setting being set to “false”.
Note: Make a backup of any files you decide you need to edit prior to making changes. Also, this will be overwritten the next time you update the theme.
Tried and editing above mentioned lines. The video is still autoplays. In Source code it looks that the parameter is “1” – see below. Is there any other place where to change?
@Iulian (sorry for the incorrect name originally)
As previously stated, I really didn’t want to get too in-depth. Looks like the location you’re working with is the [VIDEO] shortcode.
You can try changing the shortcode within the /DT9/widgets/widget-singe-content.php. See image.
In the same file (widget-single-content) you may want to do the same for line #32 & line #35, which also has the [VIDEO] shortcode call.
Changed it in line 133 as you said. But I was unable to find in the same file another video short code call. However – same behaviour 🙁
One thing intrigues me. Why in source page appears with parameter 1. Not false. Somehow other file is sending the parameter 1. Should be zero. PS: I tested all variants also with zero all over.
“One thing intrigues me. Why in source page appears with parameter 1. Not false. Somehow other file is sending the parameter 1.” Would need to find all the shortcode requests for the videos to find where it’s being turned on.
This is the primary reason why I didn’t want to get too in-depth. Takes time to go over everything and even after it’s fixed it’ll be lost when the theme updates.
The last option I can offer would be to “hard-code” the autoplay params within the shortcode file.
If you manage it in one of the php files OR hard coded in the files you shared above James, would that also get changed with future updates or is it possible to make a copy of the files that I change – delete everything from them and just add the specific lines that I want to change the parameters/code?
That might not make any sense at all and might be a totally stupid question too – I can play with codes and things but am not a “techy” so have to use plain english words to ask what I am trying to ask and explain 🙂
Finally worked hardcoded. Temporary solution. It is not a rocket science for PP to have a switch in video settings with autoplay.
Yes, any of the core files.
Any time when making custom changes I’d recommend making a backup of the original as well as the custom file.
Best practice is to make a copy of the original file and add it to the child theme directory so they don’t get overwritten, however, they would still need to be updated if any of original file code changes in the update.
Unfortunately, most files cannot just be copied over. I’d offer a solution using the child theme first whenever possible.
The examples above are core files and cannot be added to the child theme directly.
Does that make sense?
Thanks James – kind of makes sense – except where you are saying make a copy of the original file and add to the child theme, but then saying they cant be copied over?
So The solution here – is change the core files, keep a copy of the original just in case and each time the theme upgrades, go back into those files and remake the changes?
BUT if you can make changes in a child theme file, then do it there where possible (or as css if it is something that can be css coded) as those are not overwritten on upgrades?
“So The solution here – is change the core files, keep a copy of the original just in case and each time the theme upgrades, go back into those files and remake the changes?”
“BUT if you can make changes in a child theme file, then do it there where possible (or as css if it is something that can be css coded) as those are not overwritten on upgrades?”
Correct, as long as it’s not the default child theme (i.e. ‘/_directory‘ is the DT9 default child theme).
However, you’ll need to check to see if the original file you copied has not changed. If so, then you’ll need to make a copy of the new file, redo the changes (unless the code changed enough to where it would no longer apply.) then add to your child theme directory (overwriting the previously edited file) .
Thanks James – I think in this instance I either need to let everyone load a video and it will autoplay or switch videos off (except then I have to add some packages) and will have a few more questions on changing how I set those up as everything is actually free on my directory site 🙂
I noticed whilst playing with everything that if you have packages turned off, you cant limit the number of media files or turn video on/off – so thats a pain too 🙂
Really appreciate all your input and help with all my questions recently – seems like a never ending journey once you get started with one thing – the next pops up 🙂 🙂
Start your new website today!