Support » Plugins » [Plugin: Google AJAX Translation] Moving the button

  • I just discovered the plugin and it’s great, but I have some questions.

    First: On pages I want to put the button somewhere else, not at the end of the page. How can this be done?

    Second: Probably I’m blind but I can not find the way to remove or add a custom line above the [Translate]. A hint?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Second: Probably I’m blind but I can not find the way to remove or add a custom line above the [Translate]. A hint?

    The readme file in the plugins tells you how to do this.

    You could change the plugin to put the button at the top of a post pretty easily. Is that what you want to do?

    If you look at the file ajaxtranslation.php you can see how to change the “[” and “]” before and after the word “Translate”. What kind of line do you want to put above it? Or are you talking about the thin straight line made by the <hr />?

    Hello again my helpful friend mono!

    Got the ajax translating beautifully – however – I read the readme file and didn’t see where we can change the location of the translate button from the bottom of the post to the top (perhaps next to the categories)?

    A php edit in the google file or in the theme file neccessary? Thanks for your help!

    Or are you talking about the thin straight line made by the <hr />?

    Exactly… my second question was that… I tried to modify the <hr class> but no succes…
    And about the first question. I want to put the button in a custom place in my page/post. Can it be done some sort of function to put in the page/post template file?

    To be more specific, I have a custom div where I want to put the translate button. Can it be done?

    Monodistortion, re: your reply above

    You could change the plugin to put the button at the top of a post pretty easily. Is that what you want to do?

    I’m a newbie and it aint so easy. Can you give me a step-by-step? Thanks!

    Some of these questions are easy so I’ll answer those first.

    You can make any changes to the <hr class="translate_hr"/> line in your CSS file by adding a few lines. This will hide the line.

    .translate_hr {
    display: none;
    }
    

    The [Translate] button can only easily be put at the top or bottom of the “entry” div because it appears through a filter of the WordPress function called the_content. If there are more people that want the button at the top I could add it as an option. For now you can make these changes:

    Find line 455

    $content .= '<hr class="translate_hr" />
    

    and change that to

    $translate_block = '<hr class="translate_hr" />
    

    Then find line 462

    return $content;
    

    and change that to

    return $translate_block . $content;
    

    There isn’t really an easy way to move the button to any arbitrary location though. It would require adding a new option and php function to the plugin and then some code in your theme to call that function to display the button. Are there other plugins you know of that do this?

    UPDATE!
    Moving the button from the bottom to the top of the post is a little easier in version 0.4.5.

    Change line 463 from:

    $content .= $translate_block;
    

    to:

    $content = $translate_block . $content;
    

    Mono:

    When I do that it repeats my posts on the same page and puts the translate block on the top of the repeated post – any ideas?

    Thanks again,
    G

    Figured it out, just replaced the two return $content; with return $translate_block . $content; – thanx!

    $content .= $translate_block;
    

    is the same thing as

    $content = $content . $translate_block;
    

    It sounds like you used

    $content .= $translate_block . $content;
    

    which is the same thing as

    $content = $content . $translate_block . $content;
    
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Google AJAX Translation] Moving the button’ is closed to new replies.