10 Comments

  1. Thanks for the quick response dude… Just what I was looking for.

    Just thought these would help you a bit…

    Post from Excel to WordPress
    Post from Word to WordPress
    VBA to WordPress

    Excellent.

  2. Thanks to you for the tutorial.

    I have one question for you if you can answer please.

    I have used the code above and have also added some more code to also include custom fields but it does not working. Could you tell me what you think the problem might be?

    I have added the following code after ‘parameters : post : date created

    ‘parameter : post structure : member : custom_fields
    strT = strT & “custom_fields”

    strT = strT & “”

    strT = strT & “MyField1My Field 1 Value”
    strT = strT & “MyField2My Field 2 Value”

    strT = strT & “”
    strT = strT & “”

    Thanks

    Right-oh

  3. Lets us try again…

    Change the “[” with “”

    ‘parameter : post structure : member : custom_fields
    strT = strT & “[member][name]custom_fields[/name][value][array]”

    strT = strT & “[data][array]”

    strT = strT & “[array][key]MyField1[/key][value]My Field 1 Value[/value][/array]”
    strT = strT & “[array][key]MyField2[/key][value]My Field 2 Value[/value][/array]”

    strT = strT & “[/array][/data][/array]”
    strT = strT & “[/value][/member]”

    • @Right foot, you were on the right way.

      Custom fields can have a unique id as well, so a basic key-value pair does not cover it ( http://codex.wordpress.org/XML-RPC_wp shows the mw_newPost data structure ).

      It requires an array with structs as [data] in stead of an array with arrays :

      ‘parameter : post structure : member : custom_fields
      strT = strT & “[member][name]custom_fields[/name][value][array][data]”

      ‘list with id-key-value structs, id is optional
      strT = strT & “[struct]”
      strT = strT & “[member][name]key[/name][value]MyField1[/value][/member]”
      strT = strT & “[member][name]value[/name][value]MyField1 Value[/value][/member]”
      strT = strT & “[/struct]”

      strT = strT & “[struct]”
      strT = strT & “[member][name]key[/name][value]MyField2[/value][/member]”
      strT = strT & “[member][name]value[/name][value]MyField2 Value[/value][/member]”
      strT = strT & “[/struct]”

      strT = strT & “[/data][/array][/value][/member]“

  4. Hey,
    great post. But it seems that you’ve made a misprint in this string:
    strT = strT & “”

    It should looks like this:
    strT = strT & “”

    Cheers
    Alex

Leave a Reply

Your email address will not be published. Required fields are marked *