Show local fonts in block editor

add_filter( ‘block_editor_settings_all’, function( $editor_settings ) { $css = wp_get_custom_css_post()->post_content; $editor_settings[‘styles’][] = array( ‘css’ => $css ); return $editor_settings; } );Continue reading

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

تغيير عمله (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 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