Showing posts tagged: wordpress

29 May 2009

Wordpress with Markdown

Posted by Jacob Emcken Comments (1)

Today I updated Wordpress which went smooth so I decided to fix a problem on my blog which appeared when I first migrated to Wordpress. I’m using the plugin Markdown for WordPress and bbPress so I can write posts with Markdown syntax and I use code sections heavily. The problem was that using special characters like: & ” ‘ within code paragraph would look like this:

& ” ‘  < >

For now I just reverts posts upon displaying so the html entities are replaced by special characters. I know this is not the right way but its temporary :)

I asked on the Wordpress IRC and a nice guy called ‘ansimation’ gave me this to work with:

function reconvert_pre_entities( $d ) {
    return preg_replace_callback('/<pre>(.*?)/sim', create_function('$matches', 'return( html_entity_decode($matches[0]) );'), $d );
}
add_action('the_content', 'reconvert_pre_entities' );

When I get a little time I’m going to incorporate this into the Markdown plugin so it wont affect any of the other blogs not using Markdown.

Tags: , ,

16 Mar 2009

Hacking Wordpress MU – Part 3

Posted by Jacob Emcken Comments (0)

I found the first problem with running this Wordpress installation on multiple domains. The installation generates a .htaccess filen in the installation directory. This won’t work when the blogs are in differet directory levels.

What I did was adding the rewite rules to the virtual host instead… that way all my domains could have different rewrite settings.

I also tried to move the upload directory away from the central Wordpress installation and into the document roots for the different domains. But this seems to be impossible due to a bug in Wordpress MU.

The last issue I found with my solution to the multiple domains with Wordpress MU is that the site admin might not be able to see the blogs on the other domains but if you know the id of the blog you can just change that in the URL and gain edit access to the blog anyway.

Example:

The user domain1_admin is site admin for domain1.com. On the domain domain2.com the a blog with the id 3 is attached. So admin logs in on domain1.com and uses this url:

http://domain1.com/wp-admin/wpmu-blogs.php?action=editblog&amp;id=3

The last few issues I can live with… so I wont be experimenting with Wordpress for a while I guess. Hope someone can use this.

Tags:

07 Feb 2009

Converting from Sendipity to Wordpress

Posted by Jacob Emcken Comments (0)

Alright… my blog is now officially migrated from Serendipity (s9y) to Wordpress. I created the new webdesign a while back and made a few small changes tonight just before the switch… let me know if you find any problems with it. The design was inspired by a Wordpress theme by webdemar.com.

A while back I found a s9y importer on Michael Tysons weblog which worked pretty well. Since my last visit a german guy had made a few small changes to it to import extended posts. I had a few of those so I grabbed his script. I had to make a small change to the import script in order to get drafts imported as drafts (and not published). I also had to insert an extra newline before and after the more-tag (<!–more–>) in order to get my markdown working as intended.

To get Markdown support in my posts I installed the plugin ‘text-control’ (even though its fairly old). I had to get the newest markdown.php and replace the one provided by the plugin to make it work (to get rid of php errors).

I had a few posts which have been pretty popular, so I made sure that old links would still work by using “Wordpress Permalinks – Custom Structure”:

/archives/%post_id%-%postname%.html

I had to make a “last minute” change which affects my Wordpress installation in order to get it working. I will blog about that later in a “Hacking Wordpress MU 2.7 – Part 3″.

I hope you like the change :D

Tags: