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 working_remove_empty_p($content) { | |
| $array = array ( | |
| '<p>[' => '[', | |
| ']</p>' => ']', | |
| ']<br />' => ']', | |
| ']<br />' => ']' | |
| ); | |
| $content = strtr($content, $array); | |
| return $content; | |
| } |
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
| /* Display all results on search page */ | |
| function change_wp_search_size($query) { | |
| if ( $query->is_search ) // Make sure it is a search page | |
| $query->query_vars['posts_per_page'] = -1; // Change 10 to the number of posts you would like to show | |
| return $query; // Return our modified query variables | |
| } | |
| add_filter('pre_get_posts', 'change_wp_search_size'); |
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 | |
| $images = get_post_meta($post->ID, 'wpsimplegallery_gallery'); | |
| if (isset($images[0]) && count($images[0]) > 0) { | |
| foreach ($images[0] as $id) { | |
| echo wp_get_attachment_image($id, 'thumbnail' ); | |
| } | |
| } | |
| ?> |
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
| // To get thumbnail from image id | |
| wp_get_attachment_image($attachment->ID, 'thumbnail' ); |
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
| // Method 1 | |
| $number = 3; | |
| if($number & 1){ | |
| echo 'Odd number!'; | |
| }else{ | |
| echo 'Even number!'; | |
| } | |
| // Method 2 |