diff options
Diffstat (limited to 'angebote/inc/functions.php')
| -rw-r--r-- | angebote/inc/functions.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/angebote/inc/functions.php b/angebote/inc/functions.php index 8fda43a..42dab03 100644 --- a/angebote/inc/functions.php +++ b/angebote/inc/functions.php @@ -62,7 +62,7 @@ function create_offer_post_type() { ), 'rewrite' => array( #'slug' => 'aangebote/%custom-taxonomy-name%', - 'slug' => 'angebote/', + 'slug' => 'angebote/%type%', 'with_front' => true, ) ) @@ -109,7 +109,12 @@ function post_link_includes_taxonomy( $post_link, $id = 0 ){ $terms = wp_get_object_terms( $post->ID, 'type' ); file_put_contents("/tmp/wp.debug", json_encode($terms)); if( $terms ){ - return str_replace( 'angebote/' , 'angebote/' . $terms[0]->slug, $post_link ); + # file_put_contents("/tmp/wp.debug", str_replace( 'angebote/' , 'angebote/' . $terms[0]->slug , $post_link )); + # return $post_link; + # return str_replace( '/angebote/' , '/angebote/' . $terms[0]->slug . '/', $post_link ); + return str_replace( '%type%' , $terms[0]->slug, $post_link ); + } else { + return str_replace( '%type%' , '', $post_link ); } } return $post_link; |
