2 URL addresses for Donate button

Support Area Forums Foundation 2 URL addresses for Donate button

Viewing 11 posts - 1 through 11 (of 11 total)
URL to the page in question:
  • Author
    Posts
  • #6497
    Dale Eby
    Participant

    Hello,

    Can you tell me please if it is possible to have 2 url addresses for the donate button.

    I am using WPML to translate a site with Spanish and English. I am making good progress on the site. The problem I having now is that under theme options => Donation Bar=> Donation URL it only allows one url for the donate button. I have 2 pages for donations, one in spanish and one in english.

    Is this something that could be hard coded if there is no easy option?

    Thank you for your great support.

    #6509
    Bill Robbins
    Moderator

    Dale,

    Great question. I’m not sure why, but WPML doesn’t seem to allow you to translate text that’s saved to the options table (that’s where the theme options are saved).

    Are you planning on having a separate home pages for English and Spanish. If you are, then we can just create a separate page template for each language’s home page. We can set the text in the donation bar to be a simple string that can be translated like the rest of the theme. The links could just be hard coded.

    If you’ll let me know if you intend on having separate home pages, I’ll think of how best to go about that.

    Thanks,
    Bill

    #6513
    Dale Eby
    Participant

    Thank you for your reply Bill.

    Yes, I am having separate pages for each language. I have these already done.

    #6525
    Bill Robbins
    Moderator

    Since you’ll have separate home pages, then this won’t be too hard then. You’ll need to use a FTP program to change and duplicate some of the files in the theme if you’re working on a remote server. Here’s what you’ll want to do:

    1. Rename the file home.php to page-english.php
    2. Duplicate the file and name the new copy page-spanish.php
    3. Edit page-spanish.php using either your FTP program, an off-line editor or WordPress’ built in editor (Appearance > Editor).
    4. At the top of the file, paste this:

    5. Next find this section:
      
      <?php if(of_get_option('include_donation_bar') == 'yes') { ?>
      	<?php get_template_part( '/includes/donation-bar' ); ?>
      <?php } ?>
      

      and replace it with this:

    6. Now for the Spanish version of the donation bar, we basically want to hard code in the text you’d like to use. To do that, you’ll need to find the spots where the options from the theme options page are loaded and then type in the text you’d like to use instead. Here’s an example:
      
      <?php echo of_get_option('donate_title'); ?>
      
    7. Since you’re using a link and not PayPal, you can skip the part that starts with <form.
    8. You can also leave the progress and goal alone if they are the same between English and Spanish. If not, then you’ll need to edit those too.
    9. Once you’re finished, save your changes.
    10. Next edit the page-english.php file. At the top of the file, paste this again:

      Just replace the Spanish with English and save your changes.

    That will give you two home pages now, one English–that’s still controlled by the theme options page, and one Spanish that is hard coded.

    If you have any trouble or questions let me know.

    Enjoy your weekend,
    Bill

    #6536
    Dale Eby
    Participant

    Thank you for taking the time to provide this information in such a clear way. I am going to attempt this today.

    Enjoy the weekend.

    #6537
    Dale Eby
    Participant

    Hi Bill,

    I followed your instructions to allow for 2 separate donation pages. It did not quite have the desired effect.

    After the changes were made I lost all the home page formatting and the majority of the content. The only thing that showed up was the blog category on the home page. This was the same for both spanish and english home pages.

    I had saved a copy of home.php so putting it back as not a problem.

    I am wondering perhaps if I had not explained the problem and myself correctly and If I have not I apologize for that.

    The website I am working on is at http://www.daleeby.com. I am not using the donation bar or the paypal connection. Just the donate button which would lead to another page with specifics on how to donate. That is where I need the the 2 url’s.

    Currently the donate button for english takes me http://www.daleeby.com/donate-today, which is a page with an explanation on how we can accept donations. This works perfect.

    On the spanish page the donate button, takes me to the http://www.daleeby.com/donate-today, as there is only one url you can specify in options for this. This is where I need the help.

    What I need is on the spanish page the url for the donate (done in spanish) to take me to the url http://daleeby.com/es/done-hoy/

    You maybe have been trying to accomplish this with the changes you proposed. I just wanted to make sure I had properly expressed myself.

    I look forward to your response. Thank you

    #6541
    Bill Robbins
    Moderator

    Dale,

    Sorry for not quite understanding, but I think this is actually a good thing. If I understand correctly WPML has built in support for a plugin called Widget Logic which uses WordPress built in conditional tag system to choose when a widget is visible. WPML adds some additional conditional tags so you can specify which language the widget is visible in. There is a post about it at http://wpml.org/2011/03/howto-display-different-widgets-per-language/ that should be able to help you there too.

    If you run into trouble, let me know.

    Great looking site by the way. I’d love to include it in our upcoming showcase if you’re open to that.

    Have a great week,
    Bill

    #6569
    Dale Eby
    Participant

    Hi Bill,

    Thank you for the complement on the site. Most of the credit goes to you though as the amazing layout is your design.

    It would certainly be no problem for you to use it in your show case. The site is a work in progress and is just about finished and is temporally parked at my domain name, http://www.daleeby.com while I work on it. It will be up and running in a week or 2 at http://www.thelavenderproject.com.

    if you like I can email you when it is finished.

    Bill, regarding your response to my last email on the donation button. I feel perhaps not explained the problem well. I will try it in more detail. I hope this helps out better.

    I have used widget logic on some areas already on the site. You are right it works great. It does not though allow you to specify url’s, only language selection.

    My problem is based specifically on trying to use the donation button, (not donation bar), to access 2 pages on the website, one for english and one for spanish, this is 2 different addresses.

    Currently in foundation theme I cannot add in 2 url’s for the donation button, only one is programmable. This is where I am referring to: (theme options => Donation Bar=> Donation Link URL, (located at the bottom of the page). It only allows one url for the donate button.

    How this affects the site:

    Currently if you click on the english part of the site it takes me http://www.daleeby.com/donate-today, which is a page with an explanation on how we can accept donations. This works perfect.

    When you switch to the spanish translation site (www.daleeby.com/es/), which is done with WPML, the donate button on the spanish home page should call up the url http://www.daleeby.com/es/done-hoy.

    It does not though it can only call up (www.daleeby.com/donate-today )as you can only enter in the one URL in the field in the options page for donations.

    So this is where I need the help.

    Is there a way to program in 2 url address for the donation button, one for the english page (www.daleeby.com/donate-today) and one for the spanish page (www.daleeby.com/es/done-hoy) ?

    I hope this helps to clarify the problem a bit better. Thank you again for your help and time.

    #6577
    Bill Robbins
    Moderator

    Dale,

    My bad, I just wasn’t thinking about the widget having one link option from the theme options page.

    To get around that, let’s just use a text widget. You can use this code inside a text widget to generate the actual donate button:

    You’ll just need to replace http://yourlink.com with the URL you’d like to link to and replace link with the text inside your button. You can place any descriptive text above that code too. That way you can create a unique widget for each language with a unique URL.

    If you run into trouble, let me know,
    Bill

    #6633
    Dale Eby
    Participant

    Hi Bill,

    This is exactly the fix I needed. Thank you.

    The widget logic plugin works well with this type of setup as well.

    #6634
    Bill Robbins
    Moderator

    That’s great to hear. Enjoy your weekend,
    Bill

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘2 URL addresses for Donate button’ is closed to new replies.