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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 to functions.php file | |
| function reg_new_user( $user_id ) { | |
| $userdata= get_userdata($user_id); // get new user data by ID | |
| wp_set_current_user( $user_id, $userdata->user_email ); //set user with ID and E-mail | |
| wp_set_auth_cookie( $user_id ); // set cookie by user ID | |
| do_action( 'wp_login', $userdata->user_email ); // wp_login action hook with user E-mail |
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
| <ul class="categories"> | |
| <?php | |
| $terms = get_terms(array( | |
| 'taxonomy' => 'maquinaria_tax', | |
| 'hide_empty' => false, | |
| )); | |
| foreach ($terms as $term) { |
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 propor($nwidth, $nheight, $mwidth, $mheight) { | |
| $percentChange = $nwidth / $mwidth; | |
| $newHeight = round( ( $percentChange *$mheight ) ); | |
| if($nheight==$newHeight ) { | |
| return true; | |
| } else { | |
| return 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
| function exclude_sub_units($query) { | |
| if(!is_admin() || wp_doing_ajax() ) { | |
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 | |
| $args = array( | |
| 'post_type' => 'comentarios_facebook', | |
| 'post_status' => 'publish', | |
| ); | |
| $comentarios = new WP_Query( $args ); | |
| if( $comentarios->have_posts() ) : | |
| ?> | |
| <ul> |
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 bp_nouveau_get_group_potential_invites( $args = array() ) { | |
| $r = bp_parse_args( $args, array( | |
| 'group_id' => bp_get_current_group_id(), | |
| 'type' => 'alphabetical', | |
| 'per_page' => 20, | |
| 'page' => 1, | |
| 'search_terms' => false, | |
| 'member_type' => false, | |
| 'user_id' => 0, |
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
| /* get width and height */ | |
| $file= wp_get_attachment_image_src( 1118, 'medium'); | |
| $image_width= $file[1]; | |
| $image_height= $file[2]; | |
| /*get file size */ | |
| $filemeta= wp_get_attachment_metadata(1118); //1118 is attachment ID | |
| $upload_dir= wp_upload_dir(); | |
| $filemeta_array = explode("/", $filemeta['file']); |