Dynamic CSS Vs Inline Issues in Code any Way around in a WordPress Themes?

Well another solution would be to use wp_add_inline_style() which affords you an opportunity to inject dynamic inline styles: function my_custom_style() { wp_enqueue_style( ‘custom-style’, get_template_directory_uri() . ‘/css/custom-style.css’ ); //our customer percentage set by a user in some options panel $percentage = get_theme_mod(‘my-custom-percentage’); $inline_style =<<<DOC .progress-bar { width: {$percentage}%; } DOC; //inject our custom percentage after “custom-style.css” … Read more

How to review WordPress website php version compatibility?

By default WP is very reluctant to show or display any errors. That’s inline with its strategy of “dumbing down” things of sorts. The configuration I use to monitor for errors is along the lines of this in wp-config.php: define( ‘WP_DEBUG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); @ini_set( ‘display_errors’,’Off’ ); @ini_set( ‘log_errors’,’On’ ); @ini_set( ‘error_log’,’/home/user/logs/php_site_name.log’ … Read more

How do you override the default comment template?

Now what if you have to add/remove fields from default contact form to change the feel of your comment box? I am eliminating website field from default comment box by playing with ‘fields’ argument:in comments.php <?php $comment_args = array(‘title_reply’ => ‘Got Something To Say:’, ‘fields’ => apply_filters(‘comment_form_default_fields’, array( ‘author’ => ‘<p class=”comment-form-author”>’ . ‘<label for=”author”>’ … Read more

How to quickly reorder posts in the admin panel that will persist for the wp-api

Let’s assume it stores the custom order into the menu_order column in the wp_posts table. If you mean the hierarchical page post type (supports page-attributes) then one can order with the query variables: /wp-json/wp/v2/pages/?orderby=menu_order&order=asc If you mean the post post type with: /wp-json/wp/v2/posts/ there’s a way using the rest_{post_type}_query filter: /** * Set orderby to … Read more

how an array index could be a file path

The string given by $plugin_path is used as an array key for $wp-plugin_paths, this is pretty standard behaviour in setting an array so it can be accessed later, to retrieve $plugin_realpath via $wp_plugin_paths[$plugin_path]. If you want to see how it all comes out you can do: add_action(‘init’,’print_plugin_paths’); function print_plugin_paths() { global $wp_plugin_paths; foreach ($wp_plugin_paths as … Read more

Is there any way to get all the name or slug of template parts used in a page?

You could filter the include paths returned by get_included_files by removing any files from the list that are not in your theme (and/or child theme) directory: function get_theme_includes() { $includedfiles = get_included_files(); // normalize theme paths for matching $styledir = str_replace(“\\”,”https://wordpress.stackexchange.com/”,get_stylesheet_directory()); $templatedir = str_replace(“\\”,”https://wordpress.stackexchange.com/”,get_template_directory()); $i = 0; // loop included files foreach ($includedfiles as $includedfile) … Read more