Changeset 1592729
- Timestamp:
- 02/09/2017 07:23:33 PM (9 years ago)
- Location:
- magnet/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
WP-klangoo.php (modified) (4 diffs)
-
class-fake-page.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
magnet/trunk/README.txt
r1588183 r1592729 3 3 Tags: Klangoo, Magnet, Related articles, Recommended articles, Summary, Personalization, Analytics, Semantic, Analysis, Entity, Entities, Names, In-text links, SEO, interlinking 4 4 Requires at least: 4.0 5 Tested up to: 4.7 5 Tested up to: 4.7.2 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 46 46 47 47 == Changelog == 48 = 1.0.11 = 49 * Bug fixes. 48 50 = 1.0.10 = 49 51 * Bug fixes. -
magnet/trunk/WP-klangoo.php
r1588183 r1592729 5 5 Plugin URI: http://magnet.klangoo.com/wp-plugin 6 6 Description: This plugin allows Klangoo clients to integrate our services inside their WordPress sites with ease. 7 Version: 1.0.1 07 Version: 1.0.11 8 8 Author: Klangoo 9 9 Author URI: http://klangoo.com … … 43 43 } 44 44 45 if( -900 != get_the_ID() && -800 != get_the_ID() ) {46 if ( $page_type == "article") {45 if( -900 != get_the_ID() && -800 != get_the_ID() && -700 != get_the_ID() ) { 46 if ( "article" == $page_type ) { 47 47 ?> 48 48 <meta itemprop="identifier" content="<?php the_ID(); ?>"/> … … 68 68 <?php 69 69 } 70 }elseif ( get_the_ID() == -900){70 }elseif ( -900 == get_the_ID() ){ 71 71 ?> 72 72 <meta itemprop="pageType" content="relart" /> 73 73 <?php 74 }elseif( get_the_ID() == -800){74 }elseif( -800 == get_the_ID || -700 == get_the_ID ){ 75 75 ?> 76 76 <meta itemprop="pageType" content="entrelart" /> … … 258 258 } 259 259 260 function magnet_rewrite_add_rewrites()261 {262 add_rewrite_rule(263 '^entities/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$',264 'index.php?pagename=entities&entid=$matches[1]&entname=$matches[2]&lang=$matches[3]&paged=$matches[4]',265 'top'266 );267 268 add_rewrite_rule(269 '^entities/([^/]+)/([^/]+)/([^/]+)/?$',270 'index.php?pagename=entities&entid=$matches[1]&entname=$matches[2]&lang=$matches[3]',271 'top'272 );273 flush_rewrite_rules();274 }275 276 260 /* Runs on plugin deactivation*/ 277 261 register_deactivation_hook( __FILE__, 'magnet_remove' ); 278 //register_activation_hook( __FILE__, 'magnet_rewrite_add_rewrites' );279 262 280 263 add_action( 'wp_head', 'magnet_head' ); -
magnet/trunk/class-fake-page.php
r1588183 r1592729 138 138 * Check if the requested page matches our target 139 139 */ 140 141 140 if ( strtolower( $wp -> request ) == strtolower( $this -> rel_article_slug ) || ( isset( $wp->query_vars['page_id'] ) && $wp -> query_vars[ "page_id" ] == $this -> rel_article_slug ) ) { 141 $posts = array(); 142 142 $post = $this -> createPost( $this -> rel_article_slug, $this -> rel_article_title, -900 ); 143 $posts = array(); 144 $posts[] = $post; 145 /** 146 * Trick wp_query into thinking this is a page (necessary for wp_title() at least) 147 * Not sure if it's cheating or not to modify global variables in a filter 148 * but it appears to work and the codex doesn't directly say not to. 149 */ 150 $wp_query->queried_object = $post; 151 $wp_query -> is_page = true; 152 //Not sure if this one is necessary but might as well set it like a true page 153 $wp_query -> is_singular = false; 154 $wp_query -> is_single = false; 155 $wp_query -> is_home = false; 156 $wp_query -> is_archive = false; 157 $wp_query -> is_category = false; 158 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here 159 unset( $wp_query -> query[ "error" ] ); 160 $wp_query -> query_vars[ "error" ] = ""; 161 $wp_query -> is_404 = false; 143 $posts[] = $post; 144 $wp_query->queried_object = $post; 145 $wp_query -> is_page = true; 146 //Not sure if this one is necessary but might as well set it like a true page 147 $wp_query -> is_singular = false; 148 $wp_query -> is_home = false; 149 $wp_query -> is_archive = false; 150 $wp_query -> is_category = false; 151 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here 152 unset( $wp_query -> query[ "error" ] ); 153 $wp_query -> query_vars[ "error" ] = ""; 154 $wp_query -> is_404 = false; 162 155 }elseif( strtolower( $wp -> request ) == strtolower( $this -> rel_entity_slug ) || ( isset( $wp->query_vars['page_id'] ) && $wp -> query_vars[ "page_id" ] == $this -> rel_entity_slug ) ) { 163 $posts = array();156 $posts = array(); 164 157 $post = $this -> createPost( $this -> rel_entity_slug, $this -> rel_entity_title, -800 ); 165 $posts[] = $post; 166 167 $wp_query->queried_object = $post; 168 $wp_query -> is_page = true; 169 //Not sure if this one is necessary but might as well set it like a true page 170 $wp_query -> is_singular = false; 171 $wp_query -> is_home = false; 172 $wp_query -> is_archive = false; 173 $wp_query -> is_category = false; 174 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here 175 unset( $wp_query -> query[ "error" ] ); 176 $wp_query -> query_vars[ "error" ] = ""; 177 $wp_query -> is_404 = false; 178 }elseif( ( strpos ( strtolower( $wp -> request ), strtolower( $this -> rel_entity_slug_new )) == 0 ) || ( isset( $wp -> query_vars['page_id'] ) && $wp -> query_vars[ "page_id" ] == $this -> rel_entity_slug_new ) ) { 179 $posts = array(); 158 $posts[] = $post; 159 $wp_query->queried_object = $post; 160 $wp_query -> is_page = true; 161 //Not sure if this one is necessary but might as well set it like a true page 162 $wp_query -> is_singular = false; 163 $wp_query -> is_home = false; 164 $wp_query -> is_archive = false; 165 $wp_query -> is_category = false; 166 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here 167 unset( $wp_query -> query[ "error" ] ); 168 $wp_query -> query_vars[ "error" ] = ""; 169 $wp_query -> is_404 = false; 170 }elseif( strtolower( $wp -> request ) == strtolower( $this -> rel_entity_slug_new ) || ( isset( $wp -> query_vars['page_id'] ) && $wp -> query_vars[ "page_id" ] == $this -> rel_entity_slug_new ) ) { 171 $posts = array(); 180 172 $post = $this -> createPost( $this -> rel_entity_slug_new, $this -> rel_entity_title, -700 ); 181 $posts[] = $post; 182 183 $wp_query->queried_object = $post; 184 $wp_query -> is_page = true; 185 //Not sure if this one is necessary but might as well set it like a true page 186 $wp_query -> is_singular = false; 187 $wp_query -> is_home = false; 188 $wp_query -> is_archive = false; 189 $wp_query -> is_category = false; 190 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here 191 unset( $wp_query -> query[ "error" ] ); 192 $wp_query -> query_vars[ "error" ] = ""; 193 $wp_query -> is_404 = false; 173 $posts[] = $post; 174 $wp_query->queried_object = $post; 175 $wp_query -> is_page = true; 176 //Not sure if this one is necessary but might as well set it like a true page 177 $wp_query -> is_singular = false; 178 $wp_query -> is_home = false; 179 $wp_query -> is_archive = false; 180 $wp_query -> is_category = false; 181 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here 182 unset( $wp_query -> query[ "error" ] ); 183 $wp_query -> query_vars[ "error" ] = ""; 184 $wp_query -> is_404 = false; 194 185 } 195 186 196 187 return $posts; 197 188 }
Note: See TracChangeset
for help on using the changeset viewer.