Changeset 1339644
- Timestamp:
- 01/30/2016 01:41:15 PM (9 years ago)
- Location:
- local-geo-search/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
local-geo-search/trunk/classes/class.virtualpage.php
r1312446 r1339644 85 85 //add_action('template_redirect', array(&$this, 'template_redir')); 86 86 add_filter('the_posts', array(&$this, 'vtp_createdummypost')); 87 88 //remove post thumbnail (only shows up when there is a post with an id=1 that also has a featured image) 89 add_filter('get_post_metadata', array(&$this,'remove_post_thumbnail'), true, 4); 87 90 88 91 // we also force comments removal; a comments box at the footer of … … 114 117 } 115 118 119 function remove_post_thumbnail($metadata, $object_id, $meta_key, $single) { 120 121 //Return false if the current filter is that of a post thumbnail. Otherwise, return the original $content value. 122 return ( isset($meta_key) && '_thumbnail_id' === $meta_key && $object_id==1 ) ? false : $metadata; 123 124 } 125 116 126 // Setup a dummy post/page 117 127 // From the WP view, a post == a page … … 128 138 global $wp, $wp_query; 129 139 140 //limit the virtual page to only show one post 130 141 $wp_query->posts_per_page = 1; 131 132 //unset($wp_query->query['attachment']);133 134 142 135 143 //create a fake post intance 136 144 $p = new stdClass; 145 137 146 // fill $p with everything a page in the database would have 138 147 $p->ID = -1; … … 169 178 $wp_query->is_archive = FALSE; 170 179 $wp_query->is_category = FALSE; 180 $wp_query->is_attachment = false; 181 182 //stop page from throwing 404 error 171 183 unset($wp_query->query['error']); 172 184 $wp->query = array(); … … 174 186 $wp_query->is_404 = FALSE; 175 187 188 //manage comment options 189 $wp_query->comment_count = 0; 190 // -1 for current_comment displays comment if not logged in! 191 $wp_query->current_comment = null; 192 193 //tell wordpress a post exists 176 194 $wp_query->current_post = $p->ID; 177 195 $wp_query->found_posts = 1; 178 196 $wp_query->post_count = 1; 179 $wp_query->comment_count = 0;180 // -1 for current_comment displays comment if not logged in!181 $wp_query->current_comment = null;182 183 //as184 $wp_query->is_attachment = false;185 197 186 198 $wp_query->post = $p; … … 189 201 $wp_query->queried_object_id = $p->ID; 190 202 $wp_query->current_post = $p->ID; 191 $wp_query->post_count = 1;192 203 193 204 return array($p); -
local-geo-search/trunk/readme.txt
r1312446 r1339644 50 50 51 51 == Changelog == 52 = 1.0.12 = 53 * prevent featured image of a blog post with a database id=1 from displaying on Local Geo Search dynamically generated pages 54 52 55 = 1.0.11 = 53 56 * fixed plugin authentication when wordpress site url includes a path in addition to the domain
Note: See TracChangeset
for help on using the changeset viewer.