System: API endpoint for plugins

function register_review_list() { register_rest_route(‘review/v1’, ‘reviewList’, [ ‘methods’ => WP_REST_SERVER::READABLE, ‘callback’ => ‘review_list_results’ ]); } function review_list_results($data) { $results = []; // basic error handling if (false === isset($data[‘term’]) ) { return [ ‘error’ => ‘No soup for you…’ ]; }…Continue reading

Post_Created_Sample_Trigger

class Post_Created_Sample_Trigger extends \Uncanny_Automator\Recipe\Trigger { protected function setup_trigger() { // Define the Trigger’s info $this->set_integration( ‘SAMPLE_INTEGRATION’ ); $this->set_trigger_code( ‘POST_CREATED_SAMPLE’ ); $this->set_trigger_meta( ‘POST_TYPE’ ); // Trigger sentence $this->set_sentence( sprintf( esc_attr__( ‘{{A post type:%1$s}} is created sample trigger’, ‘automator-sample’ ), ‘POST_TYPE’ )…Continue reading

Allow SVG Files Upload (copy)

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

تغيير عمله (copy)

/** * Change a currency symbol */ add_filter(‘woocommerce_currency_symbol’, ‘change_existing_currency_symbol’, 10, 2); function change_existing_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case ‘مصري’: $currency_symbol = ‘جنيه’; break; } return $currency_symbol; }Continue reading

Admin Panel Footer – Menu

add_filter( ‘admin_footer_text’, function ( $footer_text ) { // Edit the line below to customize the footer text. $footer_text = ‘Check Scorecard | Get Kallados | Check GT Speed | Check Goog Speed | Update CSP | Login CDN‘; return $footer_text;…Continue reading

Admin Bar – Updates

function add_updates_admin_bar_menu() { global $wp_admin_bar; $wp_admin_bar->add_menu( array( ‘id’ => ‘updates’, ‘title’ => ‘Updates’, ‘href’ => admin_url( ‘update-core.php’ ), ‘parent’ => ‘top-secondary’, ) ); } add_action( ‘wp_before_admin_bar_render’, ‘add_updates_admin_bar_menu’ );Continue reading

WP Forms Modern Reviews

/** * Custom shortcode to display WPForms form entries in table view. * * Basic usage: [wpforms_entries_table id=”FORMID”]. * * Possible shortcode attributes: * id (required) Form ID of which to show entries. * user User ID, or “current” to…Continue reading

Customize Donation Stats

/** * Customize the stats that are shown in the Donation Stats widget. * * In this example, we only show the stats specific to a particular category. * * @param array $donation_stats The default stats to show. * @return…Continue reading