Rewrite url / permalink for default archive – yearly / monthly

You can do this without adding rewrite rules by changing the $date_structure of the $wp_rewrite instance of the WP_Rewrite class: function wpa116030_init(){ global $wp_rewrite; $wp_rewrite->date_structure=”about/blog/archive/%year%/%monthnum%/%day%”; } add_action( ‘init’, ‘wpa116030_init’ ); Visit your Permalinks settings page after adding this code to flush the rewrite rules.

Put post ID on the custom post type URL

It’s quite easy, actually: Change the generated permalink structure so that it ends with the post ID and not the post slug (but it still contains the post slug): // After you registered the post type: register_post_type( ‘ex_article’, $args ); // .. run this code: global $wp_rewrite; $wp_rewrite->extra_permastructs[‘ex_article’][‘struct’] = ‘sa/%ex_article%/%post_id%’; Then replace the post ID … Read more

Relative or Absolute Paths for Flash Video Player Files

When dealing with WordPress and Flash, we have to use always absolute URLs. When embedding, when referencing inside the ActionScript, in XML files and when dealing with Remoting. This way is hassle free. I put my SWFs inside wp-content/swf/ and use the URL http://example.com/wp-content/swf/my-flash.swf. There’s nothing virtual about this, it has to be real.

How to get rid of index.php?

This is a classical case. All you need to do is to use Rewrite Rules. With Apache, you can do it in .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress More on this in codex.

Custom permalink structure

I’ll look into the last two soon but for the top 3 you could do the following: mysite.com/post-type-slug/post1: This defaults to the post type name you specify when registering it but can be altered by changing the rewrite argument in the register_post_type() call. register_post_type( ‘posttype’, array( // … all the other args… ‘rewrite’ => array( … Read more

Change website URL without breaking links or images? WP 3.3

There is a helpful codex article about moving WordPress: http://codex.wordpress.org/Moving_WordPress. Basically, you need to find/replace the DB for instances of your old domain, and swap them with your new domain. One additional trick I’ve learned when moving WordPress between environments: since WordPress stores the domain in several places as serialized data in the DB, you … Read more

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