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
| Snippet: [[SnippetName]] | |
| Chunk: [[$ChunkName]] | |
| System Setting: [[++SettingName]] | |
| TV: [[*fieldName/TvName]] | |
| Link tag: [[~PageId? ¶mName=`value`]] | |
| Placeholder: [[+PlaceholderName]] | |
| <?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
| require_once( ABSPATH . 'wp-admin/includes/image.php' ); | |
| $img_id = get_post_thumbnail_id( $service->ID ); | |
| $parsed = parse_url( wp_get_attachment_url( $img_id ) ); | |
| $url = ABSPATH . dirname( $parsed [ 'path' ] ) . '/' . rawurlencode( basename( $parsed[ 'path' ] ) ); | |
| $url = str_replace('/', '/', $url); | |
| $attach_data = wp_generate_attachment_metadata( $img_id, $url ); | |
| wp_update_attachment_metadata( $img_id, $attach_data ); |
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 set_max_height(elms, addh) { | |
| if (typeof(addh) === 'undefined') addh = 0; | |
| var maxHeight = Math.max.apply(null, elms.map(function (){ | |
| return jQuery(this).height(); | |
| }).get()); | |
| elms.height(maxHeight+addh); | |
| } |
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_action( 'template_redirect', 'so16179138_template_redirect', 0 ); | |
| function so16179138_template_redirect() | |
| { | |
| if( is_singular() ) | |
| { | |
| global $post, $page; | |
| $num_pages = substr_count( $post->post_content, '<!--nextpage-->' ) + 1; | |
| if( $page > $num_pages ){ | |
| include( get_template_directory() . '/404.php' ); | |
| exit; |
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
| // only published term | |
| $args = array(); | |
| $args['posts_per_page'] = 99999999999; | |
| $args['post_type'] = 'ask'; | |
| $args['tax_query'] = array('relation' => 'AND'); | |
| $args['tax_query'][] = array( | |
| 'taxonomy' => 'qstatus', | |
| 'field' => 'id', | |
| 'terms' => array(19), | |
| 'operator' => 'NOT IN' |
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
| // yoast rel fixes | |
| add_filter( 'wpseo_prev_rel_link', 'hide_it'); | |
| add_filter( 'wpseo_next_rel_link', 'hide_it'); | |
| function hide_it($str) { | |
| if (is_home() || is_post_type_archive('services') || is_post_type_archive('reviews') || is_post_type_archive('contacts')) { | |
| return false; | |
| } else { | |
| $search = array( | |
| 'pressroom/news/', | |
| 'pressroom/articles/' |
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 remove_page_from_query_string($query_string) { | |
| if (is_admin()) return $query_string; | |
| if ($query_string['name'] == 'page' && isset($query_string['page'])) { | |
| unset($query_string['name']); | |
| // 'page' in the query_string looks like '/2', so i'm spliting it out | |
| list($delim, $page_index) = split('/', $query_string['page']); | |
| $query_string['paged'] = $page_index; | |
| } | |
| return $query_string; | |
| } |
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
| var is_ajaxed = false; | |
| $.ajaxSetup({ | |
| //async: false | |
| }); | |
| $(document).ajaxSend(function() { | |
| console.log( "is_ajaxed." ); | |
| is_ajaxed = true; | |
| }); |
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_children($wp_query) { | |
| if (isset($wp_query->query_vars['tax_name'])) { | |
| $wp_query->set('tax_query', array(array( | |
| 'taxonomy' => 'tax_name', | |
| 'field' => 'slug', | |
| 'terms' => $wp_query->query_vars['tax_name'], | |
| 'include_children' => 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 checkErrors(el) { | |
| var errors = false | |
| el.find('input, textarea').each(function(){ | |
| if ($(this).val() == '') { | |
| $(this).closest('.form-group').addClass('has-error'); | |
| errors = true; | |
| } else { | |
| $(this).closest('.form-group').removeClass('has-error'); | |
| } | |
| }); |
NewerOlder