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_filter( 'posts_where' , 'klausk_search_where',100 ); | |
| function klausk_search_where( $where ) { | |
| if (!is_admin() && is_main_query() && is_search()) { | |
| $ex = explode( ' AND (', $where); | |
| $meta_q = array_pop($ex); | |
| $where = str_replace(' AND ('.$meta_q,'',$where); | |
| $where = str_replace(')))',") OR ({$meta_q}))",$where); | |
| } | |
| return $where; |
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_filter('pre_get_posts','klausk_search_advanced'); | |
| function klausk_search_advanced($q=false){ | |
| if (!is_admin() && $q->is_main_query() && $q->is_search()) { | |
| $q->set('post_type', array( 'post', 'question' ) ); | |
| } | |
| return $q; | |
| } | |
| ?> |
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_filter('pre_get_posts','klausk_search_meta'); | |
| function klausk_search_meta($q=false){ | |
| if (!is_admin() && $q->is_main_query() && $q->is_search()) { | |
| $meta_query = array( | |
| array( | |
| 'key' => 'klausk_answer', | |
| 'value' => like_escape($q->get('s')), | |
| 'compare' => 'LIKE', | |
| ), |
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 | |
| function klausk_template_part($slug,$name=null) { | |
| do_action( "get_template_part_{$slug}", $slug, $name ); | |
| $templates = array(); | |
| $name = (string) $name; | |
| if ( '' !== $name ) | |
| $templates[] = "{$slug}-{$name}.php"; | |
| $templates[] = "{$slug}.php"; | |
| return locate_template($templates); | |
| } |
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( | |
| 'category_name' => 'pavadinimas', | |
| 'post_status' => 'inherit', | |
| 'post_type' => 'attachment', | |
| 'post_mime_type' => 'image', | |
| ); | |
| $myquery = WP_Query($args); | |
| while ($myquery->have_posts()) : | |
| $myquery->the_post(); |
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 | |
| class Klausk_Filter { | |
| private $id = 0; | |
| private $compare = '<'; | |
| public function __construct($id,$compare = '<') { | |
| $this->id = intval($id); | |
| $this->compare = $compare; | |
| } | |
| public function filter($where){ | |
| $where .= " AND `ID` {$this->compare} {$this->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 | |
| $post_id = 500 | |
| $p = get_post($post_id); | |
| $args = array( | |
| 'date_query' => array( | |
| 'before' => $p->post_date, | |
| // 'after' => $p->post_date | |
| 'inclusive' => true, | |
| ), | |
| 'exclude'=>$post_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 | |
| add_action( 'publish_to_trash', 'klausk_delete_menu_item' ); | |
| function klausk_delete_menu_item($post) { | |
| // tik puslapiams | |
| if( $post->post_type !== 'page' ) | |
| return; | |
| // jei tema nepalaiko meniu - nieko daryti nereikia | |
| if ( ! current_theme_supports( 'menus' ) ) { return; } | |
| // trinamas meniu punktas | |
| _wp_delete_post_menu_item($post->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 | |
| $slider_show = get_option('general_enable_slider'); | |
| $slider_auto = get_option('general_auto_play'); | |
| $slider_speed = get_option('general_slider_delay'); | |
| $slider_animation_time = get_option('general_animation_time'); | |
| if(empty($slider_speed)) {$slider_speed = "4000";} | |
| if(empty($slider_animation_time)) {$slider_animation_time = "1000";} | |
| if($slider_show[0] == 'yes') : | |
| // if($slider_show[0] == 'yes') { | |
| ?> |
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
| .tiny_coffee_form button { | |
| background-color:#000; /* pasirinkite norimą spalvą */ | |
| } |