Call to undefined function get_current_screen() on my localhost
you can try following if ( !function_exists( ‘get_current_screen’ ) ) { require_once ABSPATH . ‘/wp-admin/includes/screen.php’; } $screen = get_current_screen(); echo $screen;
you can try following if ( !function_exists( ‘get_current_screen’ ) ) { require_once ABSPATH . ‘/wp-admin/includes/screen.php’; } $screen = get_current_screen(); echo $screen;
On-topic answer: You can just put <?php wp_login_form(); ?> into any of your theme templates to render a login form on the front end of your site. Or make your own shortcode [loginform] by putting this into your theme’s functions.php: function wpse_242473_login_form() { return wp_login_form( ‘echo’ => false ); } add_shortcode( ‘loginform’, ‘wpse_242473_login_form’ );
asked a few times, this link has some good answers Opinions and recommendations on the best barebones base theme
The key, I think, to what you are doing is to use “offset” <div class=”col4 inner-left”> <ul class=”popular-list”> <?php query_posts(‘order=DESC&posts_per_page=3&post_type=pop’); if (have_posts()) : while (have_posts()) : the_post(); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/125200/<?php the_permalink(); ?>”><?php the_title(); ?></a> </li> <?php endwhile; endif; ?> </ul> </div> <div class=”col4 inner-right”> <ul class=”popular-list”> <?php query_posts(‘order=DESC&posts_per_page=3&post_type=pop&offset=3’); if (have_posts()) : while (have_posts()) : … Read more
If you’re using the built in custom background stuff, it’s already all using postMessage. So, just bind a function to the background_color message and adjust your border color accordingly. Something like this, I expect: wp.customize(‘background_color’,function( value ) { value.bind(function(to) { jQuery(‘whatever’).css(‘color’, to ? to : ” ); }); }); Obviously, change the jQuery call in … Read more
This is the proper way to load a custom javascript in your child theme, wp_localize_script is only necessary if you need to exchange data between JS and PHP (Client and server). function assets() { wp_register_script(‘ajax_filter’, get_stylesheet_directory_uri() . ‘/js/ajax-filter-posts.js’, [‘jquery’], ‘1.0’, false); wp_enqueue_script(‘ajax_filter’); wp_localize_script( ‘ajax_filter’, ‘mdu’, array( ‘nonce’ => wp_create_nonce( ‘mdu’ ), ‘ajax_url’ => admin_url( ‘admin-ajax.php’ … Read more
Your question and answer comes down to template hierarchy and how it works, and it is really really useful to know the basics here. I’m not going to go into details as I will need to write a short story, but here are the basics: WordPress uses a very strict hierarchy for loading templates on … Read more
This can become a quite an expensive operation which can seriously damage page load time. At this stage, your code is quite expensive. Lets look a better way to tackle this issue. What we need to do is to minimize the time spend in db, and to do this, we will only get the info … Read more
I’ll describe what I did on a project recently that had similar requirements. First thing I did was bundle less.php in my theme and create a function to compile a .less file in my theme into CSS and return the result. It looked like this: function wpse_283711_get_customizer_css() { $css=””; if ( file_exists( get_theme_file_path( ‘customizer.less’ ) … Read more
You’re almost there, except each widget’s settings are stored separately from the sidebars_widgets option, which just stores widget “instances”. Try out the following function – you’ll still need to use register_sidebar, but it eases the pain for then pre-registering widgets on those sidebars. What it also does is ensure that any existing widgets & their … Read more