wp-cli: For development, how can I activate a theme that is on the local disk but not zipped?

[S/O to @TomJNowell whose comments helped me track down the issue. Sharing in case it could help others troubleshoot a similar problem] In my setup, I’m using two Docker containers with different images: wordpress:4.9: wp container wordpesss:cli: wp-cli container In order to allow wp-cli container access to the WordPress config, files, etc., I configured them … Read more

When trying to override plugin’s function by theme, my filter executes two times, I want it to run only a single time

Probable cause of double increment: The plugin function dokan_get_admin_commission_by() executes apply_filters(‘dokan_order_admin_commission’ … ) twice, but both times it uses return, so the filter is not executing twice. The probable cause of getting double increment is because, in the following CODE: if ($saved_admin_fee != ”) { return apply_filters(‘dokan_order_admin_commission’, $saved_admin_fee, $order); } the plugin is giving your … Read more

How to get current post user id

To show author avatar per post inside loop you need to modify a little: $current_post_author_id = get_the_author_meta( ‘ID’ ); <?php if (!empty(get_user_meta($current_post_author_id, ‘user_avatar’, true))): ?> <img src=”https://wordpress.stackexchange.com/questions/317789/<?php echo get_user_meta($current_post_author_id,”user_avatar’, true); ?>” alt=”some text”> Try, if it works for you.

Is it possible to edit the styling of the admin panel from within a custom theme?

Everything you’re able to do in a plugin you could do in a theme. It’s more like that separation is preferred, see article: https://managewp.com/blog/themes-design-plugins-functionality Below an example adding editor stylesheet: /** * Registers an editor stylesheet for the theme. */ add_editor_style( array( ‘assets/css/bootstrap.min.css’, ‘https://use.fontawesome.com/releases/v5.3.1/css/all.css’, ‘style.css’, )); Below an example to add scripts to the WP … Read more

How do I get current page ID in WordPress customizer file?

Thanks for your question. active_callback is exactly what you’re looking for. You can use it with controls: $wp_customizer->add_control( ‘setting_name’, array( ‘type’ => ‘text’, ‘section’ => ‘section_name’, ‘label’ => ‘Option with context’, ‘active_callback’ => ‘is_front_page’ ) ); and with sections: $wp_customize->add_section( ‘section-name’, array( ‘title’ => ‘Section with context’, ‘active_callback’ => ‘is_front_page’ ) ); In examples above, … Read more

How can I defer these JS files?

What Are Async And Defer Attributes? Here’s what the async and defer attributes do: Async Attribute: The async attribute loads the script asynchronously. In other words, ensures that the script loads asynchronously along side the other contents of the page, after which it is executed. Defer Attribute: The defer attribute defers loading of the script. … Read more