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
// All sub-site drop down display | |
if (!function_exists('get_all_multisite_links')) { | |
function get_all_multisite_links($menu_name = 'Primary') | |
{ | |
global $blog_id; | |
$current_blog_id = $blog_id; // Get current blog id | |
switch_to_blog(1); // change blog to 'parent site' (ID = 1) | |
$primaryNav = wp_get_nav_menu_items($menu_name); | |
$menu_object = wp_get_nav_menu_object($menu_name); | |
?> |
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_action('registered_post_type', 'make_posts_hierarchical', 10, 2); | |
function make_posts_hierarchical($post_type, $pto) | |
{ | |
if ($post_type != 'post') return; // Return, if not post type posts | |
global $wp_post_types; // access $wp_post_types global variable |
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
/ Add this code in function.php file | |
// Taxonomy Filter through Ajax without Submit button | |
require get_stylesheet_directory() . '/template-parts/content/taxonomy-filters-ajax.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
function get_terms_dropdown_type($taxonomy, $args) | |
{ | |
$taxo_obj = get_taxonomy($taxonomy); | |
$taxo_singular_name = $taxo_obj->labels->singular_name; | |
$terms_obj = get_terms($taxonomy, $args); | |
if ('category' === $taxonomy) { | |
$taxonomy_name = 'cat'; | |
} elseif ('post_tag' === $taxonomy) { | |
$taxonomy_name = 'tag'; |
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
// List of post need to modify. | |
// $posts = array( | |
// array( | |
// 'id' => 1, | |
// 'term' => get_term_id_by_name(array('parent', 'child')), | |
// 'taxonomy' => 'category', | |
// ), | |
// array( | |
// 'id' => 5, | |
// 'term' => get_term_id_by_name(array('parent')), |
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
// Add script only on homepage | |
add_action('wp_footer', 'add_script_on_homepage'); | |
function add_script_on_homepage() { | |
if( is_page( 'Home' ) || is_home() || is_front_page()) { | |
?> | |
<script> | |
... | |
... | |
... | |
</script> |
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
CMD to Check VIP Coding standard phpcs --standard=WordPressVIPMinimum,WordPress,WordPress-Docs /data1/betaie/wp-content/themes/vip/indianexpress/template-parts/sports/ipl/stats-table-data.php | |
CMD to fix VIP Coding standard phpcbf --standard=WordPressVIPMinimum,WordPress,WordPress-Docs /data1/betaie/wp-content/themes/vip/indianexpress/template-parts/sports/ipl/stats-table-data.php | |
phpcs --standard=WordPressVIPMinimum,WordPress,WordPress-Docs /home/online/Documents/PHPCS/file.php | |
Install compose | |
Open VS Code IED | |
Install Extention phpcs | |
Open Terminal ctr + ` | |
Navigate to Local Server's main directory Ex - C:\xampp\htdocs\ | |
Create folder 'wpcs' in main directory (command) composer create-project wp-coding-standards/wpcs --no-dev |
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
VS Code Extentions Name Developer Language | |
------------------------------------------------------------------------------------------------------- | |
-------------- | |
Theme & Colors | |
-------------- | |
Material Theme - Mattia Astorino | |
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
---------------------------------------- | |
Perform checks as per PHPCS stadard | |
---------------------------------------- | |
phpcs --standard=WordPressVIPMinimum,WordPress,WordPress-Docs [File name along with full path] | |
------------------------------------------------------- | |
Automatic fixes with PHPCBF Stadards | |
------------------------------------------------------- | |
phpcbf --standard=WordPressVIPMinimum,WordPress,WordPress-Docs [File name along with full path] |
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
- Add Google reCaptcha 3 on HTML form | |
- On form load, get the google recaptcha response in hidden form field | |
- On form submit, Send recaptha field value to php file | |
- Validate google captcha with server side |