Help with SQL commands to interact with a MySQL database
- Mac /usr/local/mysql/bin
- Windows /Program Files/MySQL/MySQL version/bin
- Xampp /xampp/mysql/bin
| { | |
| "phpcs.enable": true, | |
| "editor.fontFamily": "'Hack Nerd Font Mono', Menlo, Monaco, 'Courier New', monospace", | |
| "color-highlight.languages": [ | |
| "*" | |
| ], | |
| "editor.fontSize": 14, | |
| "editor.lineHeight": 25, | |
| "php.validate.enable": false, |
| function scrollToDivFromHash() { | |
| const hash = window.location.hash; | |
| if (hash) { | |
| const targetId = hash.substring(1); // Remove the '#' | |
| const targetDiv = document.getElementById(targetId); | |
| if (targetDiv) { | |
| targetDiv.scrollIntoView({ behavior: 'smooth' }); // Smooth scrolling | |
| } | |
| } | |
| } |
| use Drupal\node\Entity\Node; | |
| use Drupal\taxonomy\Entity\Term; | |
| use Drupal\views\ViewExecutable; | |
| use Drupal\views\Views; | |
| use Drupal\Core\Render; | |
| $nid = 1; | |
| $entity_type = 'node'; | |
| $view_mode = 'teaser'; | |
| $builder = \Drupal::service('entity_type.manager')->getViewBuilder($entity_type); | |
| $storage = \Drupal::service('entity.manager')->getStorage($entity_type); |
| jQuery(function($) { | |
| /** | |
| * catch AJAX complete events, to catch wordpress actions | |
| * @param {jQuery.Event} event | |
| * @param {jqXHR} xhr XmlHttpRequest object | |
| * @param {Object} settings options for the AJAX request | |
| */ | |
| $(document).ajaxComplete(function(event, xhr, settings) { | |
| // Specify the AJAX action after which you want to execute your JS | |
| if ("data" in settings && settings.data.indexOf("action=your_ajax_action") != -1) { |
| <?php | |
| function return_with_k_in_number( $number ) { | |
| if( $number>1000 ) { | |
| $x = round($number); | |
| $x_number_format = number_format($x); | |
| $x_array = explode(',', $x_number_format); | |
| $x_parts = array('K', 'M', 'B', 'T'); |
| <?php | |
| //Capture a new member signup. Only ever triggers once for each new member. | |
| //Does not trigger for exising members who have subscribed to a Membership before. | |
| // | |
| //The user may not be logged in when this is called | |
| //as it is triggered when a user is added over the REST API, | |
| //and also when a user is added from the dashboard (MemberPress -> Members -> Add New) | |
| function mepr_capture_new_member_signup_completed($event) { | |
| $user = $event->get_data(); | |
| $txn_data = json_decode($event->args); |
| <?php | |
| register_activation_hook( __FILE__, 'plugin_create_db' ); | |
| function plugin_create_db() { | |
| // Create DB Here | |
| global $wpdb; | |
| $charset_collate = $wpdb->get_charset_collate(); | |
| $table_name = $wpdb->prefix . 'test_table'; | |
| $sql = "CREATE TABLE $table_name ( | |
| id mediumint(9) NOT NULL AUTO_INCREMENT, |
| <?php | |
| function tl_save_error() { | |
| update_option( 'plugin_error', ob_get_contents() ); | |
| } | |
| add_action( 'activated_plugin', 'tl_save_error' ); |
| <?php | |
| function cpm_cc_customize_register( $wp_customize ) { | |
| $wp_customize->add_panel('cpm_cc_option_panel', array( | |
| 'capability' => 'edit_theme_options', | |
| 'theme_supports' => '', | |
| 'title' => __('CC Options'), | |
| 'description' => __('Panel to update theme options'), // Include html tags such as <p>. | |
| 'priority' => 10 // Mixed with top-level-section hierarchy. | |
| ) |