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_filter( 'pre_get_posts','add_to_query' ); | |
| function add_to_query( $query ) | |
| { | |
| if ( is_post_type_archive( 'listings' ) ): | |
| $query -> set( 'orderby' , 'title' ); | |
| $query -> set( 'order' , 'asc' ); | |
| endif; | |
| return $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
| function datediff($timestamp) | |
| { | |
| $difference = time() - strtotime($timestamp); | |
| if($difference < 60){ | |
| $s = ($difference == '1' ? '' : 's'); | |
| return $difference." second$s ago"; | |
| }else{ | |
| $difference = round($difference / 60); | |
| if($difference < 60){ |
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
| On Form Page: | |
| $form_errors = process_form(); | |
| In the form (contains any validation errors) | |
| <?php validation_errors(); ?> | |
| Form Elements (example) |
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 | |
| /* | |
| Plugin Name: Mobile Theme Switcher | |
| Description: | |
| Version: 0.1 | |
| Author: Ben May | |
| Author URI: | |
| */ | |
| class roarMobile { |
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
| // if the user_meta 'vsc_fame' is set for a user, then their comments will ALWAYS be approved, | |
| // regardless if they are failed because they contain links etc. | |
| function comments_edr_hofs( $approved , $commentdata ) | |
| { | |
| if( isset( $commentdata['user_ID'] ) ) | |
| { | |
| if( get_the_author_meta( 'vsc_fame', $commentdata['user_ID'] ) ) | |
| { | |
| return 1; |
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
| tar -zcvf backup-name.tar.gz --exclude='wp-content/uploads/*' /var/www/site.com |
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
| // I put this code in the file where I add my custom post types / taxonomies. | |
| // Flush rewrite rules on change of this file. | |
| if( get_option('custom_pt_rules') != md5_file( __FILE__ ) ) | |
| { | |
| add_action( 'init', function() | |
| { | |
| global $wp_rewrite; | |
| $wp_rewrite->flush_rules(); | |
| }); | |
| update_option('custom_pt_rules', md5_file( __FILE__ ) ); |
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($) { | |
| addSelectAlltoTaxGroup( 'region' ); | |
| addSelectAlltoTaxGroup( 'program' ); | |
| function addSelectAlltoTaxGroup( key ) | |
| { | |
| var selectAll = "<span class=\"my-selector\"> | <a href=\"#"+key+"-adder\" id=\""+key+"-select-all\">Select All</a></span>"; | |
| var deselectAll = "<span class=\"my-selector\"> | <a href=\"#"+key+"-adder\" id=\""+key+"-deselect-all\">Deselect All</a></span>"; |
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_filter( 'upload_mimes', array( &$this, 'mimes' ) ); | |
| function mimes ( $existing_mimes=array() ) | |
| { | |
| $existing_mimes['srt'] = 'text/plain'; | |
| return $existing_mimes; | |
| } |
OlderNewer