How to programatically create a simple HTML page using the permalink of a WordPress post?
How to programatically create a simple HTML page using the permalink of a WordPress post?
How to programatically create a simple HTML page using the permalink of a WordPress post?
If you enqueue your style sheet first you should be able to use wp_add_inline_style afterwards. function custom_style() { wp_enqueue_style(‘your_css’, plugin_dir_url( __FILE__ ) . ‘style/your_css.css’ ); $bg_color = get_option(‘custom_color’); $custom_css = ” body { background-color: {$bg_color}; }”; wp_add_inline_style( ‘your_css’, $custom_css ); } This is not tested (just written from mind) and I have never used it … Read more
Share common libraries across multiple themes/plugins
Generally, replacing content, especially with output buffering, is, at least in my mind, not very good practice. So you might consider making use of wordpress’ templating system – see Codex: Templates for a start. The former would also lead to, where your markup has to go. Or if you not using templates you have to … Read more
You can run a script that will programmatically set the featured image for each post. You can use the first attached image for this. To get the attached images run a query for the posts and loop through each one and use get_children() setting the post_parent to the current post id in your loop. $posts … Read more
No, you don’t need to validate/clean/escape because of security flaws in wordpress. WordPress use prepared statements by default. However, you can validate by yourself that the content is what you expecting. For example if you only want numbers you can use is_numeric() or is_float(). Or match the input value to an array of predefined strings.
You need to add_action two time for this. One at the time of user registration & second when user tries to login. function wpse_149067( $user_id ) { if ( user_can( $user_id, ‘tutor’ ) ) update_user_meta($user_id, ‘verified_user’, false); if ( user_can( $user_id, ‘student’ ) ) update_user_meta($user_id, ‘verified_user’, true); } add_action( ‘wp_login’, ‘wpse_149067_check_user’, 10, 2); function wpse_149067_check_user($user_login, … Read more
Very Slow loading. Plugins report provided by P3 included
This turned out to be an issue between a php.ini file in my wordpress installation and the system’s php.ini file. WordPress will use the one in its directory and ignore everything in the system php.ini file. Deleting the wordpress php.ini file fixed the issue.
You can ask for the activation of the theme. You can get the value of the options values templateand stylesheet. The stylesheet get the active style, a benefit if the user use an child theme. As example if ( ‘my_theme’ === get_option( ‘stylesheet’ ) ) …. Also you can use the hooks for template and … Read more