Creating a dynamic URL structure

Demonstrated here: http://thereforei.am/2011/10/28/advanced-taxonomy-queries-with-pretty-urls/ Here’s the final code to autogenerate the necessary rules: It’s quite likely you will at some stage want to programmatically generate rewrite rules for multiple custom post types with various taxonomies. You could do it manually, but that’s no fun. Let’s use an automatic rewrite rule generator. The function below takes a … Read more

Shortcode for a link and thumbnail

You are assigning the attachment URL to your $url variable: $url = wp_get_attachment_url( get_post_thumbnail_id( $id ) ); then passing that same variable back to wp_get_attachment_url: return ‘<img src=”‘ . wp_get_attachment_url( $url ) . ‘”/><a href=”‘ . get_permalink( $id ) . ‘”>’ . get_the_title( $id ) . ‘</a>’; You should simply output it instead: return ‘<img … Read more

Author Nickname URL Friendly

You’ve already used sanitize_title once in you code. You need to use that in again, inside the wpse5742_author_link function. $link = str_replace( $author_nicename, sanitize_title($author_nickname), $link ); That should take care of the spaces. Another other option is to use urlencode but sanitize_title keeps things consistent. I (minimally) tested your code with that change and it … Read more

Changing RSS feed URL structure

After some thought – this can be achieved with some creative abuse of existing feeds: easy part – redirect category feeds to page comment feeds hard part – make page comment feeds think they are category feeds Something like this: Category_Feed_At_Page::on_load(); /** * Repurpose page feeds for category of same name feeds. */ class Category_Feed_At_Page … Read more

Adding pretty query parameters

You would need a custom rewrite rule for that: http://codex.wordpress.org/Rewrite_API/add_rewrite_rule I think you might have a hard time though, with it being within an area of the site (single post type) already using a custom rewrite rule!

Query var removed after rewrite

Maybe you are not using the correct hooks nor the correct rewrite rule. You are rewriting to pagename, which is for pages. You should use name to get posts by slug. add_filter(‘query_vars’, ‘cyb_add_query_vars’); function cyb_add_query_vars( $vars) { $vars[] = “item”; return $vars; } add_action(‘init’,’cyb_add_rewrite_rules’); function cyb_add_rewrite_rules() { add_rewrite_rule( ”^shows/([^/]+)/([^/]+)/?$” , ‘index.php?post_type=shows&name=$matches[1]&item=$matches[2]’ , ‘top’ ); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)