andy30z
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Way to Allow User to Switch Page Colors?You can try this it will select all elements on the page:
var activated = 0; document.getElementById("button").addEventListener('click', function () { if (activated == 0) { setStyle("background-color: white; color: black !important"); activated = 1; } else { setStyle("background-color: black; color: white !important"); activated = 0; } }); function setStyle(myStyle) { var elements = document.getElementsByTagName("*"); for(var i in elements) { if(elements[i].setAttribute) { elements[i].setAttribute("style", myStyle); } } }
Forum: Developing with WordPress
In reply to: Way to Allow User to Switch Page Colors?I would suggest looking at your page using a browser developer tool. If you press F12 in most browsers (I prefer Chrome) and the developer tools should pop up and will allow you to inspect the elements. Inspect the headlines and other elements that don’t have the colors you want and look at the styles and you should be able to see which style is overriding your colors. Then you can adjust your styles so they have priority. The !important helps deal with conflicts but it doesn’t always work. You will have to select the headlines specifically if they aren’t inheriting the colors from the body.
Forum: Developing with WordPress
In reply to: How to create shortcode in classI like to call the add_shortcode function in __construct function of the class.
class PluginExample { public function __construct() { add_shortcode('say-hello', array($this, 'hello')); } public function hello() { echo '<h3>Hello World!</h3>'; } } $pluginExample = new PluginExample();
Forum: Developing with WordPress
In reply to: Way to Allow User to Switch Page Colors?You could try this:
var activated = 0; document.getElementById("button").addEventListener('click', function () { if (activated == 0) { document.body.setAttribute("style", "background-color: white; color: black !important"); activated = 1; } else { document.body.setAttribute("style", "background-color: black; color: white !important"); activated = 0; } });
Adding the !important tag to your color attribute should override most of the color on the page, depending on how your theme’s style sheet is setup.
- This reply was modified 6 years, 11 months ago by andy30z.
Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] Registration SpeedI have figured it out. It’s the sending of email that is slowing things down, probably due to the fact that I’m using shared hosting.
Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] Registration SpeedI do not have a cache plugin. So I’ve disabled all my plugins and it still takes 17 seconds. I’m not sure what could be causing this. Is this normal for WordPress? Could it be a server configuration issue?