WARNING Create a snapshot before doing any changes!!!
Example new user data:
- Username: exampleuser
- Password: examplepassword
- Home: /home/exampleuser/
- IP: exa.mp.le.ip
| <?php | |
| //Note Wordpress only uses the first category applied to a post. | |
| $category = get_the_category(); | |
| if (!empty($category)) { | |
| echo 'Category: <a class="post-category" href="' . esc_url(get_category_link($category[0]->term_id)) . '">' . esc_html($category[0]->name) . '</a>'; | |
| } |
| <?php | |
| // Will output links displayed like: | |
| // Tags: Article Tag | Other Article Tag | Another Article Tag | |
| $post_tags = get_the_tags(); | |
| $separator = ' | '; | |
| $output = ''; | |
| if (!empty($post_tags)) { | |
| echo "Tags: "; |
| <?php | |
| $startDate = new DateTime("1976-04-30"); | |
| $today = new DateTime('Y'); | |
| $interval = $startDate->diff($today); | |
| echo $interval->y . " YEARS"; | |
| ?> |
| #!/usr/bin/env bash | |
| # From: https://stackoverflow.com/a/42956288 | |
| # example: dir=/home/smith/Desktop/Test | |
| parentdir=$(builtin cd $dir; pwd) |
| // From: https://codingartistweb.com/2021/06/highlight-searched-text-with-javascript/ | |
| function search() { | |
| // Use the id of the input ex: text-to-search | |
| let textToSearch = document.getElementById("text-to-search").value; | |
| // Use the id of the source to be searched ex: paragraph | |
| let paragraph = document.getElementById("paragraph"); | |
| // Characters in search input to be escaped: [.*+?^${}()|[\]\\] | |
| textToSearch = textToSearch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | |
| let pattern = new RegExp(`${textToSearch}`, "gi"); |
| # ssh-keygen for ed25519 | |
| ssh-keygen -a 100 -t ed25519 -f "/ABSOLUTE/PATH/TO/.ssh/PROFILE_SAASPROVIDER_ed25519" -C "PROFILE_SAASPROVIDER_ed25519" | |
| # ssh-keygen for rsa 4096 | |
| ssh-keygen -b 4096 -t rsa -f "/ABSOLUTE/PATH/TO/.ssh/PROFILE_SAASPROVIDER_rsa" -C "PROFILE_SAASPROVIDER_rsa" |
| find . -name "*.pdf" -type file -exec cp {} /path/to/directory \; |
| <?php | |
| $slug = get_post_field( 'post_name', get_post() ); | |
| echo $slug; | |
| ?> |
| <?php | |
| // Custom Search Results Subheading | |
| add_filter( 'custom_search_results_subheading', function( $subheading ) { | |
| if ( is_search() ) { | |
| global $wp_query; | |
| $posts_per_page = $wp_query->query_vars['posts_per_page']; | |
| $posts_found = $wp_query->found_posts; | |
| if ( $posts_found ) { | |
| $subheading = sprintf( | |
| esc_html__( 'Displaying results 1-%1$s out of %2$s for %3$s', 'total' ), |