This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $user_id = 209; | |
| $url = is_multisite() ? get_blogaddress_by_id( (int) $blog_id ) : home_url('', 'http'); | |
| $user = new WP_User( (int) $user_id ); | |
| $adt_rp_key = get_password_reset_key( $user ); | |
| $user_login = $user->user_login; | |
| $rp_link = '<a href="' . network_site_url("wp-login.php?action=rp&key=$adt_rp_key&login=" . rawurlencode($user_login), 'login') . '">' . network_site_url("wp-login.php?action=rp&key=$adt_rp_key&login=" . rawurlencode($user_login), 'login') . '</a>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Find value in PHP Associate array | |
| Array | |
| ( | |
| [0] => Array | |
| ( | |
| [city_id] => 1 | |
| [city_name] => Abc | |
| ) | |
| [1] => Array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* Template Name: Demo - CPT with pagination | |
| * Template will display listing of 'custom post type' along with pagination underneath (numerical style) | |
| */ | |
| ?> | |
| <?php get_header() ?> | |
| <?php | |
| $currentPage = get_query_var( 'paged' ); // Get var from query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add REST API related scripts | |
| function add_script_for_rest_api() { | |
| wp_enqueue_script('jquery-validate', get_stylesheet_directory_uri().'/assets/js/jquery.validate.min.js', array('jquery'), 1.17, true ); | |
| wp_enqueue_script('as-wp-api', get_stylesheet_directory_uri().'/assets/js/rest-api.js', array('jquery'), 1.0, true ); | |
| wp_localize_script( 'as-wp-api', 'wpApiSettings', array( | |
| 'root' => esc_url_raw( rest_url() ), | |
| 'nonce' => wp_create_nonce( 'wp_rest' ) | |
| ) ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Load fresh CSS file each time when that CSS file get modified (User will see the latest changes all time) | |
| // Ref - https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2056 | |
| wp_enqueue_style('main-style', get_stylesheet_directory_uri() . '/assets/css/main.css', array(), filemtime(get_stylesheet_directory() . '/assets/css/main.css'), false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Wordpress Folder Structure | |
| 1 - wp-admin | |
| 2 - wp-content | |
| 3 - wp-includes | |
| 4 - .htaccess | |
| 5 - index.php | |
| 6 - wp-config.php | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($) { | |
| // Perform AJAX login on form submit | |
| jQuery('#as-login-form').on('submit', function(e){ | |
| event.preventDefault(); | |
| $error = 0; | |
| var ajaxUrl = ajax_login_object.ajaxurl; | |
| var username = jQuery("#username").val(); | |
| var password = jQuery("#password").val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Angular | |
| You need to set up your development environment before you can do anything. | |
| Install Node.js® and npm if they are not already on your machine. | |
| Install the Angular CLI globally | |
| npm install -g @angular/cli | |
| Get 1 back to main directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Remove WordPress menu from admin bar*/ | |
| add_action( 'admin_bar_menu', 'remove_wp_logo', 999 ); | |
| function remove_wp_logo( $wp_admin_bar ) { | |
| $wp_admin_bar->remove_node( 'wp-logo' ); | |
| } | |
| // Update WP login screen logo | |
| function update_wp_logo_for_login_page() { | |
| ?> | |
| <style type="text/css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Display HTML SiteMap with shortcode "html_sitemap" | |
| function as_display_html_sitemap( $pageArgArr ) { | |
| if ( class_exists( 'WooCommerce' ) ) { // If woocommerce is activated, remove these pages | |
| $pageToBeExclude = array('Cart', 'Checkout', 'Shipping Addresses', 'My Account', 'Payment', 'Thank you', 'Sitemap'); | |
| foreach ($pageToBeExclude as $page) { | |
| $pageObj = get_page_by_title( $page ); | |
| $pageIdsTobeExclude[] = $pageObj->ID; | |
| } |