Multiple Calls to Action?

Is it possible to have a different call to action for each slide in the Sydney theme?

Absolutely wonderful theme BTW.

Hello there,

In order to achieve that objective, could you please try to do the following?

  1. Create a child theme if you haven’t been running it yet. You would need to download the Sydney child theme here. Unzip, then open the style.css file, replace Template: sydney to Template: sydney-pro-ii.

  2. Copy this function into the most bottom of your child theme’s functions.php file

  3. Create a new “js” folder in your child theme. Create a new child-customizer.js inside this folder.

  4. In the js > child-customizer.js, insert this code

  5. Install and activate this child theme

  6. To set the CTA button for each slide item, go to Appearance > Customize > Header Area > Header Slider:

  • CTA text for the first slide

  • CTA URL for the first slide

  • CTA text for the second slide

  • CTA URL for the second slide

and so on…

Regards,
Kharis

Oh Gosh that is a lot…I’m better off just figuring out the 3 sections that configure under the main slider front page.

how do i create a child theme. i downloaded the file but i don’t see anything named "child theme"
I also don’t see anything in the zip file that says "template Sydney"
I am very inexperienced with php but looking to learn.
When i open style.css i am noit sure what to do next\

Thanks for your help

Hello @leonstancil,

Our documentation page has been updated. Please download the Sydney Pro child theme here.

Regards,
Kharis

Ok thanks,

What steps do i take to install the child theme?

Hello there,

Please follow this link, then go to “Adding New Themes” section.

Regards,
Kharis

Hi guys,

We’re not going to be adding options for different buttons in the theme as this isn’t a feature that most people would use, but we did add some easy code to do this in our new (not yet launched) code library: https://athemes.com/snippets/different-buttons-slide/

It basically hides the default button and you can create one different button for each of your slides. Any issues, let me know.

hi there!
its working for me.
The problem i have now is when i want to translate the page with polylang in the tab string translations there is only the deafult call to action slider button.
how do i translate the other 4?

Hello there,

Please try this solution which might work for you as well.

Regards,
Kharis

hi there!
thank you for your response.
I am affraid i am using a slightly different code for custom slider buttons. Can i apply the code you provided me or will it break something?
The code i put into functions.php is:

What do you think? can i put the you provided me for the translation and put it in to functions.php or not?

Thanks,

M

Hello there,

Yes, you are right. We should use different approach. Please post your code at https://gist.github.com and share its link here, so I can read it easily.

Regards,
Kharis

hi,
i have put the code to gist as you told me to and it is here
i hope that’s how it was supposed to be :slight_smile:

nope, its not working…
maybe now - link
?
thanks.

Hello there,

So sorry for the delay.

Please add the following function into your child theme’s functions.php file:


/*
 * Register new button text into Polylang translation
 */
if ( function_exists('pll_register_string') ) :
	function sydney_button_text_polylang() {

		for ( $i=2; $i<=5; $i++) {
			pll_register_string('Slide button ' . $i, get_theme_mod('slider_button_text' . $i), 'Sydney');
		}

	}
	add_action( 'admin_init', 'sydney_button_text_polylang' );
endif;

Then log into your site admin area > Settings > Language > Strings translations.

Regards,
Kharis

WOW!
its working, thank you so much for this! Really, thank you,sir.

But…As always there is a but :slight_smile:
All the cta slider buttons are now translated. But the problem i have now is that when i click on the default one(on the translated site-which in my case is english) in doesn’t open the about page as it should. i only get the 404 page. The others do open the correct page but in the default language(which is slovene).
Any ideas how to fix this or what is causing this?

And one last question if i may:
How do i translate all other stuff - widgets, plugins etc…?

I don’t know code so…

Thanks so much again, really appriciate it.

Hi!
I figured out why the cta buttons link to the wrong language of a page.
In string translations there is only the string translation for the first slide, not the other 4. Similar to the buttons wich of course you so superbly fixed.
Can i ask you for code to add sliders 2-5 to string translations too?

thanks

> How do i translate all other stuff – widgets, plugins etc…?

Please read this article (Registering Our Own Dynamic Strings section). You might be interested to learn more about it on its documentation.

> Can i ask you for code to add sliders 2-5 to string translations too?

The strings won’t be automatically fetched in the strings translation if the values are still default. Change the buttons text value, please. Then visit Settings > Language > Strings Translations.

Regards,
Kharis

Hello,

I think oga says that the code you posted let’s him translate the button TEXT for buttons 2-5… but it doesnt let him translate the URL for those buttons.

To do that he should paste the same code again in functions.php but writing “sydney_button_url” instead of “sydney_button_text”

(and “sydney_button_url_polylang” instead of “sydney_button_text_polylang” )

is that correct?

Thanks,

John

Hello there,

To translate the URL of the buttons, replace this function with this one:


/*
 * Register new button text and URL into Polylang translation
 */
if ( function_exists('pll_register_string') ) :
	function sydney_button_text_polylang() {

		for ( $i=2; $i<=5; $i++) {
			pll_register_string('Slide button ' . $i, get_theme_mod('slider_button_text' . $i), 'Sydney');
                        pll_register_string('Slide button URL ' . $i, get_theme_mod('slider_button_url' . $i), 'Sydney');
		}

	}
	add_action( 'admin_init', 'sydney_button_text_polylang' );
endif;

Regards,
Kharis