Custom plugin – load enqueue only for this plugin

The WordPress documentation for admin_enqueue_scripts says that you can: function load_custom_wp_admin_style($hook) { // Load only on ?page=mypluginname if($hook != ‘toplevel_page_mypluginname’) { return; } wp_enqueue_style( ‘custom_wp_admin_css’, plugins_url(‘admin-style.css’, __FILE__) ); } add_action( ‘admin_enqueue_scripts’, ‘load_custom_wp_admin_style’ ); Basically, you’re being passed $hook and it should be the value of your page name, which is the name you’ve chosen.

How to Include Fields in Query String When Making Request of WordPress.org Plugin API?

HT to otto42 on the WordPress Slack who pointed out that false might be evaluating as true and to instead try using 0…which I did and it worked: https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[per_page]=10&request[browse]=popular&request[fields]How to Include Fields in Query String When Making Request of WordPress.org Plugin API?=0&request[page]=1

How to modify or create custom contact form 7 select options [closed]

This is not possible with Contact Form 7 plugin. Instead you can make use of the dynamic_dropdown tag offered by the CF7 plugin extension, CF7 Smart Grid-layout. This allows you to create a dynamic dropdown, which has an option to filter the drodown’s options, and therefore create a custom set of options, add_filter(‘cf7sg_dynamic_dropdown_custom_options’, ‘custom_options’); function … Read more

Easy WP SMTP plugin test email failed

If you want to configure Gmail account, you need to fill Encryption type: SSL Port: 465 Requires Authentication: Yes Or you can try https://wordpress.org/plugins/wp-mail-bank/. This would help you in authenticating the Gmail account using oAuth.

Hide DIV if empty – Plugin Gallery

This is just a matter of reorganising your PHP: $gallery = do_shortcode(‘[aigpl-gallery-slider id=”1080″ dots=”false” arrows=”false”]’); if ( ! empty( $gallery ) ) { echo ‘<div id=”photos” class=”block” style=”margin-top: 50% !important;”>’ … echo $gallery; echo ‘</div>’; }

Error with get_price (and others) in self-written plugin to show price

The error Is coming from the file: /wp-content/plugins/woocommerce-display-various/display_various.php Line 180. Disable the plugin ‘woocommerce-display-various’ and check if the problem still exists. Your code Why are you using output buffering (ob_start())? Furthermore you’re not using it correctly. There’s alot to improve on your code… See my changes: add_action(‘init’,’add_custom_price_shortcodes’); function add_custom_price_shortcodes() { if ( class_exists( ‘woocommerce’ ) … Read more

Plugin – Admin menu page broken url

The menu is generated by the function _wp_menu_output. If you look at the place where the links are generated (currently lines 158-162 and 170-174) you see that the admin.php?page= part is omitted under certain circumstances. One of those is an empty $menu_hook. The variable menu_hook is filled by a call to get_plugin_page_hook, which will return … Read more