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
| <script type = 'text/javascript' > | |
| //code to check if a value exists in an array using javascript for loop | |
| var fruits_arr = ['Apple', 'Mango', 'Grapes', 'Orange', 'Fig', 'Cherry']; | |
| function checkValue(value, arr) { | |
| var status = 'Not exist'; | |
| for (var i = 0; i < arr.length; i++) { | |
| var name = arr[i]; |
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 | |
| // Initialize URL to the variable | |
| $url = 'https://www.geeksforgeeks.org?name=Tonny'; | |
| // Use parse_url() function to parse the URL | |
| // and return an associative array which | |
| // contains its various components | |
| $url_components = parse_url($url); | |
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 | |
| //////////////////////////// | |
| // | |
| // Filter Music admin colums | |
| // by artist and genre | |
| // | |
| /////////////////////////// | |
| function filter_cars_by_taxonomies( $post_type, $which ) { | |
| // Apply this only on a specific post type |
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 | |
| //////////////////////////// | |
| // | |
| // my_edit_music_columns( $columns ) | |
| // Music CPT admin colums | |
| // | |
| /////////////////////////// | |
| function my_edit_music_columns( $columns ) { |
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
| $query_images_args = array( | |
| 'post_type' => 'attachment', | |
| 'post_mime_type' => 'image', | |
| 'post_status' => 'inherit', | |
| 'posts_per_page' => - 1, | |
| ); | |
| $query_images = new WP_Query( $query_images_args ); | |
| $images = 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
| jQuery(window).on('orientationchange resize', function (event) { | |
| if(jQuery("body").width()>768){ // Make sure to test that width... Just a suggestion here. | |
| jQuery('#main_navigation').show(); | |
| } | |
| }); |
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").each(function(i,ele){ | |
| setTimeout(function() { | |
| console.log($(ele).text()); | |
| }, (i+1)*1000); | |
| }) |
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 | |
| $tax = array( 19, 18, 214, 226, 20 ); | |
| $query_args = array ( | |
| 'post_type' => 'works', | |
| 'tax_query' => array( | |
| array( | |
| 'taxonomy' => 'materials', | |
| 'field' => 'term_id', |
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 | |
| $term = get_term(123); //Example term ID | |
| $term->name; //gets term 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('admin_init','rpt_add_role_caps',999); | |
| /** | |
| add teachers capability | |
| */ | |
| function rpt_add_role_caps() { | |
| // Add the roles you'd like to administer the custom post types | |
| $roles = array('rpt_teacher','editor','administrator'); |