WordPress.org

Ready to get started?Download WordPress

Forums

Using Google AJAX APIs in posts (6 posts)

  1. DenkoB
    Member
    Posted 4 years ago #

    Hi there,

    I've been working all day to try to bring Google visualizations into my posts.

    When I generate the code and upload it as a straight html file (i.e. not through the WordPress dashboard), everything works fine. But when I incorporate the html into a post using the WordPress dashboard, the post is blank.

    I notice that when I click on the "update post" button and then look at the source code in the post, WordPress has put in a lot of extraneous formatting tags like <p> and
    . Thinking this might be the problem, I tried a several plugins (like Raw-HTML, JavaScript Logic and FCKEditor) which claim to either prevent WP from modifying your HTML or ease the process of incorporating JavaScript into posts. Don't know whether the extra tags are the problem, but these solutions haven't worked for me.

    I'm wondering: Am I on the right track? Any ideas on what I might want to look into? Or better yet, have any WP users actually made use of that wealth of gorgeous functionality over at the Google APIs site?

    Thanks.

    Dan

  2. stvwlf
    Member
    Posted 4 years ago #

    Hi

    The WP editor mangles code, as you have discovered.

    When inserting code I sometimes create it in a custom field attached to the post. Then use a plugin called Custom Fields Shortcode to embed the custom field within the post. WP formatting does not touch anything inserted this way.
    http://wordpress.org/extend/plugins/custom-fields-shortcode/

  3. DenkoB
    Member
    Posted 4 years ago #

    Hey Steve,

    Tried the plugin, which promises to do the same thing as Raw-HTML, and it's not working for me. When I activate the plugin and surround the AJAX code with the [cf] and [/cf] tags, it simply disappears from the page source:

    '<div class="format_text entry-content">'
    [...here's where my code should show up, but there is nothing...]
    '</div>'

    Or alternately, if I surround every line with [cf] and [/cf], each line is replaced with a '
    '

    I notice that the plugin is only good up to WP 2.8.1, and I have 2.8.4, so perhaps that is the problem.

    Now I'm trying the Magic Fields plugin. Not entirely clear that it will work for this purpose, but at least it's good up to 2.8.4.

    Thanks for the help. I'm gonna keep trying things, hoping others here can offer suggestions.

    Dan

  4. stvwlf
    Member
    Posted 4 years ago #

    Hi - You are not understanding how the plugin works

    You do not put your source code in between [cf] and [/cf] in the post.

    You enter the source code as a custom field. You give a key name to the custom field and put the source code in the custom field's value box.

    Then in the post you enter the custom field's key value in between the [cf] and [/cf].

    custom field key MyCode

    custom field value ============ enter code here ==========

    in the post
    [cf]MyCode[/cf]

    works every time

  5. DenkoB
    Member
    Posted 4 years ago #

    Hi Steve,

    You're right. I didn't get it. In fact, the entire area of custom fields was a mystery. No more. Like you said, [cf]Works Every Time[/cf]!

    Thanks for your help!

    Dan

  6. rodrigomattos
    Member
    Posted 4 years ago #

    I need to add a image slideshow - I was trying Google Ajax and inserting the code onto the page through the HTML editor.

    When I update the page nothing comes up. If I save the code in wordpad and open it in a browser the code works.

    What can I do to upload this image slideshow onto any page?

Topic Closed

This topic has been closed to new replies.

About this Topic