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
| global $query_string; | |
| query_posts( $query_string . '&posts_per_page=999&orderby=title&order=DESC' ); | |
| //if (have_posts()) : while (have_posts()) : the_post(); blablabla//// |
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 parse_youtube_url($url) { | |
| $pattern = '#^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([\w-]{11})(?:.+)?$#x'; | |
| preg_match($pattern, $url, $matches); | |
| return (isset($matches[1])) ? $matches[1] : 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
| //in function.php | |
| function filter_orderby_sticky( $order = '' ) { | |
| global $wpdb; | |
| //$first = pods('pods settings'); | |
| //$first = (int)$first->field( 'name of field' ); // if pods | |
| return '('.$wpdb->prefix.'posts.ID = '.$first.') DESC, '.$wpdb->prefix.'posts.post_date DESC'; // $first is id of first post | |
| } | |
| // custom wp_query | |
| add_filter( 'posts_orderby', 'filter_orderby_sticky' ); |
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'); | |
| } | |
| }); |
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
| 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 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
| // 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
| // 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' |
OlderNewer