flatsome
-
Does this plugin work well with flatsome?
And is it just the same as just adding this line here (or does it then duplicate instead of replace)? See screenshot
https://snipboard.io/PZs5vV.jpgThanks a lot
-
At the moment I do not know another option at Flatsome than to just add the meta for the viewport.
I refer to https://ww.wp.xz.cn/support/topic/1-line-of-code/
Yes, but does your plugin replace or just add the line of code?
Flatsome tells me better use your plugin instead of putting that 1 line in the header script. That would only make sense if your plugin replaces?Thanks
If there is no option to modify the viewport by an action or filter (like I do with the Ocean WP theme), I can just add the viewort at the very last end of the meta section. I don’t know a way to replace the existing meta at the Faltsome theme. So, it is an additional meta.
Ok, so to be clear. For flatsome theme it has no use installing your plugin, because it does not modify the viewport?
If so, how can it be that your plugin does work when installing on flatsome theme? Or does it just add an additional viewport?Thanks
-
This reply was modified 4 years, 5 months ago by
bramvds.
Just install the plugin and try it by your own, please.
yes i tried the plugin and it works. But i need to know if it then replaces the viewport or just adds a viewport.
Please check my previous answer or the source code.
So it just adds a second viewport. So you have any idea why flatsome tell me better to install your plugin instead of just adding the line of code in the header script?
Flatsome tell me your plugin replaces code which is better than adding, but you tell me for flatsome theme it just adds a code?Sorry for the trouble.
Both Kybernetic and flatsome are right. This plugin adds a code line for the viewport meta. That is what you can see in the HTML code. It does not “add a second viewport” since the added line replaced the former viewport meta. That is what you can not see since that happens in the browser memory (to be more excact: in the DOM).
Alternative explanation in other words: the viewport meta before that added line becomes overwritten by the following (added) line. That is why that plugin works.
I hope to have brought some clarity.@hinjiriyo
Thanks but still not 100% clear.
Why would this plugin be better when using flatsome instead of just adding the code here:
https://snipboard.io/yvCYI0.jpg
seems to me this way it also replaces/overwrites the initial viewport.
As i have done on this site https://www.fightplaza.nl/
Or am I missing something? Just always want the best solution.Thanks.
First of all: that plugin just needs a single click to activate it. Then you can forget it. That saves time.
Second: the plugin provides more informations in the viewport meta tag than your code. Enabled zooming is more probable. Compare both:
your code
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
vs. the plugin’s code
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">
You can find useful informations about that tag here.Third: if you switch to another theme, then your code is no more printed out. The plugin on the other side is still in effect after every theme switch.
@hinjiriyo
This is not my code as you can see, you are looking at the initial viewport.
When i add my line of code in the header script or i activate your plugin, it both adds a second viewport as you can see in the video:
https://www.loom.com/share/48582526684143e1879f9ae9298593ee
or am i wrong?The plugin’s line defines more parameters than your line (
minimum-scaleandmaximum-scale). So it overwrites more controls. That makes the zoom functionality more probable and more stable to work.This no better solution?
//* remove and replace parent theme actions
function remove_actions_parent_theme() {
remove_action(‘wp_head’,’flatsome_viewport_meta’, 1);
}
add_action(‘init’,’remove_actions_parent_theme’);
//* Now re-add the customised action
function child_viewport_meta_replacing_parent_theme() {
echo apply_filters( ‘child_viewport_meta_replacing_parent_theme’, ‘<meta name=”viewport” content=”width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0″>’ ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
add_action( ‘wp_head’, ‘child_viewport_meta_replacing_parent_theme’, 1 );`@bramvds I will check your solution and implent the
remove_actionif it is possible and useful. Stay tuned for the upcoming update. -
This reply was modified 4 years, 5 months ago by
The topic ‘flatsome’ is closed to new replies.