This sheet goes along with this SSH YouTube tutorial
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
| const str = window.location.href ; | |
| const regex = /\/chaplains\/([0-9]{1,5})/g; | |
| const results = regex.exec(str); | |
| const id = results[1]; |
| function chaplains_init() { | |
| global $wp,$wp_rewrite; | |
| $wp_rewrite->add_rule('chaplains/([0-9]{4})/?$', | |
| 'index.php?pagename=mypage&id=$matches[1]', 'top'); | |
| // $wp_rewrite->flush_rules(false); | |
| } | |
| add_action('init','chaplains_init'); |
| $.ajax({ | |
| url: ajaxfunction.ajaxurl, | |
| type: 'post', | |
| data: { | |
| action: 'get_chaplains', | |
| id: id, // por si vas a enviar variables | |
| }, | |
| beforeSend: function(){ | |
| }, |
| function my_enqueue_assets() { | |
| wp_enqueue_script( 'ajax-function', get_stylesheet_directory_uri() . '/js/ajax-function.js', array(), '1.0.0', true ); | |
| wp_localize_script( 'ajax-function', 'ajaxfunction', array( | |
| 'ajaxurl' => admin_url( 'admin-ajax.php' ) | |
| )); | |
| } | |
| my_enqueue_assets(); |