Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Question re Universal Post Manager plugin and export styles WordPress

  • SOLVED

Hi All

I use the excellent Universal Post Manager plugin to enable users to export posts as Word files.

I'm able to insert some CSS in the UPM-"Saving Manager" admin options that allows posts with multiple nested ordered lists to export properly to Word, i.e., to produce this sort of numbering in the Word document:

1.
a.
b.
i.

What I'd like to be able to do is change the numbering format when a post is exported to Word.

For example, at the moment:

- the first <ol> level maps to the "1." kind of style
- the second (nested) <ol> level maps to the "a." kind of style
- the third (nested) <ol> level maps to the "i." kind of style

I'd like to be able to specify a different numbering format for the exported file, such as this:

- the first <ol> level maps to the "1." kind of style
- the second (nested) <ol> level maps to the "1.1" kind of style
- the third (nested) <ol> level maps to the "(a)" kind of style
- the fourth (nested) <ol> level maps to the "(i)" kind of style

Can anyone tell me how to do this please?

Many thanks
Richard

Answers (2)

2010-12-05

rilwis answers:

Hi Richard,

Unfortunately, lists in WP can only be converted to Numbered list in Word. I mean, we cannot have list type "1.1, 1.2" for 2nd nested list.

I even tried to style 3 nested lists in Word, but didn't succeed.

By the way, I can change the type of nested lists like this:
- the first <ol> level maps to the "1." kind of style
- the second (nested) <ol> level maps to the "(a)" kind of style
- the third (nested) <ol> level maps to the "(i)" kind of style

If you want to do that, I'll do it for you.


Richard comments:

Thanks rilwis. Much appreciated. Yes please, I would like to know how to change the type of nested lists as you mention. If you could do that, I'll select you as the winner.

Cheers
Richard


rilwis comments:

To change lists' format, just put these lines after line 1136 in functions.php file <strong>of the plugin</strong> (not theme functions.php file):

$doc_body = preg_replace( '|<ol|i','<ol type="1"', $doc_body );
$doc_body = preg_replace( '|<li(.*?)<ol type="1"|ism','<li$1<ol type="a"', $doc_body );
$doc_body = preg_replace( '|<li(.*?)<li(.*?)<ol type="a"|ism','<li$1<li$2<ol type="i"', $doc_body );


I also upload this file for you to download, in case of not correct copy & paste. Download it here:

http://dl.dropbox.com/u/795417/functions.php

Note: <strong>This hack has to be done again if you upgrade the plugin</strong>.


Richard comments:

Thanks very much for this rilwis. Much appreciated.

Richard

2010-12-05

idt answers:

I think your best bet would be the Phrase Filter functionality. I suggest you put unique identifiers to ur <ol> elements by adding id maybe so you'll be able to differentiate the first, second, third and fourth ul for your Find and Replace under Phrase Filter. You put the HTML you want to be replaced into numbers then enable “Do phrase filter on saving”.


Richard comments:

Many thanks idt but I don't think this will work. The documents/posts I'm creating have numerous multi-level nested ordered lists, where the numbering of the first level needs to be sequential throughout. I can't see this being possible with what you suggest. That said, if you think I'm missing, I'd be grateful if you'd let me know please.

Many thanks
Richard