Page_link change

As suspected, this needed a rewrite rule.. I don’t know why post_link filter didn’t need a rewrite rule added.. function ba_rewrite() { add_rewrite_rule(‘^([^/]*)?.php’, ‘index.php?pagename=$matches[1]’, ‘top’); } add_action( ‘init’, ‘ba_rewrite’ );

Change Image depending on page path

If you are dealing with a category page, you would simply use conditional tags, as suggested by @milo: if ( is_category( ‘cat-1’ ) ) { $url=”my-background-image-url-1.ext”; } else if ( is_category( ‘cat-2’ ) ) { $url=”my-background-image-url-2.ext”; } remember, you could pass in a category slug as well as a category name or an array containing … Read more

Broken paths on taxonomies after changing permalink to post name

I added a rewrite rule manually. add_rewrite_rule(‘^bar([^/]+)(/[0-9]+)?/?$’,’index.php?bar=$matches[1]’,’top’); right after add_action(‘init’, ‘register_taxonomy_bar’); in functions.php. But WordPress is SERIOUSLY DENSE in translating /bar/foo/ to barfoo?bar=foo and I don’t know how to get around this nonsensical “barfoo” in the path. I also have no idea what it’ll do to paging. Also this has to be defined for each … Read more

How to structure a wordpress site in folders?

I would suggest a combination of using pages for the parent directory content and comments handling e.g with the slug/cars-home/ and a custom post type to gather each single cars e.g. /cars/red/. — /cars/red/ (single CPT) — /cars/blue/ (single CPT) — /cars/white/ (single CPT) –/cars-home/ (page) Next you can either add a custom loop to … Read more

How to create an IIS7 re-write rule for a single category

I would strongly suggest leaving IIS alone and implement your requirements in WordPress: /** * Remove category base from “newcat” permalink. * * @param string $link * @param object $term * @return string */ function wpse_175424_term_link( $link, $term ) { if ( $term->taxonomy === ‘category’ && $term->slug === ‘newcat’ ) $link = home_url( user_trailingslashit( $term->slug … Read more