Permalink Custom Page Template

You would probably be better served to not rely on the page-pagename.php method of applying custom templates to a page, and be more deliberate with assigning the template. At the top of your page-manga.php file, include a template reference: <?php /* Template Name: Manga Page */ ?> Now on your Manga page, find the Page … Read more

Conditional Permalink based on category?

Answering My own question.. That was easier than I though.. I used the post_link filter to modify the permalink in the following way.. function custom_permalink( $permalink, $post ) { // Get the categories for the post $post = get_post( $post_id ); $category = get_the_category( $post_id ); $post_year = mysql2date(“Y”, $post->post_date); $target_cat = 6; // Category … Read more

Custom Post Type Pretty Structure

I’ve configure permastructure for posts to /blog/%postname%/, I’ve created a page with slug about-us and I used the code bellow to register team_member CPT and it is working. I think you had a extra “https://wordpress.stackexchange.com/” in the rewrite argument. Also, you don’t need to works with global $wp_rewrite; if you set the rewrite argument when … Read more

Custom permalink structure for remote content pages

I think your problem has several solutions. If you don’t want to have one entry in WP database for each remote item, a possible solution could be to have a page with property slug and add a rewrite rule to get the ID number: add_action( ‘init’, ‘cyb_property_rewrite_rule’ ); function cyb_property_rewrite_rule() { add_rewrite_rule( ‘^property/([0-9]{1,})/?$’, ‘index.php?pagename=$matches[1]&remote_ID=$matches[2]’, ‘top’ … Read more

Add variables to all permalinks in site

All permalink output has filters you can use to modify it: post_link, post_type_link, page_link, tag_link, category_link, term_link. A simple example with page_link: function wpd_append_query_string( $url, $id ) { // check some condition and add a query string var if( some_condition ) { $url = add_query_arg( ‘var’, 1, $url ); } return $url; } add_filter( ‘page_link’, … Read more