How to add CSS style sheet dynamically in wordpress
It seems like copy/paste gone wrong – both your variables point to same URL link and so file_exists() fails because it expects local path. Change $myStyleFile to local path and it should work.
It seems like copy/paste gone wrong – both your variables point to same URL link and so file_exists() fails because it expects local path. Change $myStyleFile to local path and it should work.
In wp_enqueue_style()‘s 5th parameter is not boolean. Use following code: function libload() { wp_enqueue_style(‘style_file’ , plugin_dir_url(__FILE__).’lib/plugin_styles.css’); wp_enqueue_script(‘js_file’, plugin_dir_url(__FILE__).’lib/plugin_js.js’, array(), null, true); } add_action(‘wp_enqueue_scripts’,’libload’);
Some digging around led me to find that all the items were marked up with the class sub-menu which I was able to style in the CSS.
Two options. The first would be as you said to determine the browser size using javascript. Then have your code do something where it changes the link if the browser us either above or below a certain size. The second, and this may be your preferred method, would be to use css. If your theme … Read more
The best way to override plugin css is with specificity. That way you only need to target the rules which you want to override. You should also verify that wp_head(); is just before the closing tag and not before your <link rel=”stylesheet” type=”text/css” media=”all” href=”https://wordpress.stackexchange.com/questions/121639/<?php bloginfo(“stylesheet_url’ ); ?>” /> If you really need to get … Read more
Add this code in to wp-config.php just before – require_once ABSPATH . ‘wp-settings.php’; line if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’) $_SERVER[‘HTTPS’]=’on’;
You could attack the get_pages(); function another way to sort your code better and read it better as well, take a look at this link for more info. <?php $args = array( ‘sort_order’ => ‘ASC’, ‘sort_column’ => ‘post_title’, // sorting by alphabetical order of post title for example ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ … Read more
Seems there are a few elements missing First is the quotes in is_tax(country), should be is_tax(‘country’) Second you are missing closing and opening PHP tags When working with action that require html output you can do it in a few ways. For now we will stick with the method you wanted to use. The final … Read more
WordPress is not HTML. It’s PHP-based templates that build the HTML pages. You need more than just a quick answer. You need to learn about the entire process WordPress uses to build pages. Perhaps one place is to start here to figure out how WP works: https://codex.wordpress.org/New_To_WordPress_-_Where_to_Start . And if you are not comfortable with … Read more
You asked, “the fact that I know the CSS classes ‘ought’ to be enough right?” Eh, maybe. But not like you think. CSS is of course for styling. The example you gave where the class forgetmenot was set to display:none was not, as you wrote, replacing some CSS. It was overruling it, but the original … Read more