Viewing 20 posts - 1 through 20 (of 37 total)
  • Author
    Posts
  • #58151
    widespread
    Member

    Hi Catch Themes and everyone.

    I’m using the Polylang plugin to make a double language WordPress website together with your nice Catch-Base Theme. So far no problems at all.

    The only thing that I don’t know how to make happen is letting Polylang translate the Featured Content Title and Description on the homepage.

    All the other strings instead (like website title, description, search bar text, …), are seen by Polylang, and are shown in a table in the plugin settings where I can easily translate them into other languages.

    Could you update the theme so that those strings I mentioned could be translated too? Or could you advice a quick fix meanwhile, if you don’t plan that it will happen soon?

    Thanks a lot guys!
    I’m gonna keep recommending this theme of course! 🙂

    #58203
    Sakin
    Keymaster

    @widespread: For this you need to add xml file wpml-config.xml in catch-base theme directory.

    <wpml-config>
        <admin-texts>
            <key name="catchbase_options">
    			<key name="featured_content_headline"/>
                <key name="featured_content_subheadline"/>	
            </key>
        </admin-texts>
    </wpml-config>

    Then add the following code in your theme functions.php file

    /**
     * Template for Clearing WPML Invalid Cache
     *
     * To override this in a child theme
     * simply create your own catchbase_wpml_invalidcache(), and that function will be used instead.
     *
     * @since Catch Base
     */
    function catchbase_wpml_invalidcache() {
    	delete_transient( 'catchbase_featured_content' );
    
    } // catchbase_wpml_invalidcache
    endif;
    
    add_action( 'after_setup_theme', 'catchbase_wpml_invalidcache' );

    Note: We need to work on this to make our theme Polylang plugin ready. It’s getting late as we are suffering from earthquake and after shocks in Nepal. So, it will be delayed for now.

    #58398
    widespread
    Member

    Thanks! And I really hope things will slowly get better there. My heart is with you guys.

    About the code you provided, after making the changes I get this:

    Warning: array() expects parameter 1 to be a valid callback, function ‘catchbase_featured_content’ not found or invalid function name in /home/my_website/public_html/wp-includes/plugin.php on line 496

    I’m using a child theme for catch base so I put both the xml and the functions.php code in the child theme folder and child theme functions.php, is that ok?

    Also I deleted that “endif” after the function.

    Thanks again.

    #58413
    Sakin
    Keymaster

    @widespread: Sorry, I have edited the code above. Now you can try new one, where I replaced
    add_action( 'after_setup_theme', 'catchbase_featured_content' );
    with
    add_action( 'after_setup_theme', 'catchbase_wpml_invalidcache' );

    #58442
    widespread
    Member

    Thanks, I tried changing the code, no errors now, but in Polylang settings I can’t see the text fields for translating Featured Content Title and Description.

    What am I missing? Again, I’ve saved the wpml-config.xml in catch-base-child-theme folder, and edited functions.php in catch-base-child-theme folder and also removed that “endif;” from your code.
    Is this all correct?

    What else could it be that I am missing?

    #58476
    Sakin
    Keymaster

    @widespread: Not sure, you might need to ask plugin support. Can you go to “Settings => Languages => string translations”

    #58530
    widespread
    Member

    @Sakin: yes that’s the settings I’m talking about: in that page I can’t see “featured content title” and “featured content description” strings fields.

    I saved this in public_html/wp-content/themes/catch-base-child/wpml-config.xml

    <wpml-config>
        <admin-texts>
            <key name="catchbase_options">
    			<key name="featured_content_headline"/>
                <key name="featured_content_subheadline"/>	
            </key>
        </admin-texts>
    </wpml-config>

    and this in public_html/wp-content/themes/catch-base-child/functions.php

    function catchbase_wpml_invalidcache() {
    	delete_transient( 'catchbase_featured_content' );
    
    } // catchbase_wpml_invalidcache
    /* endif; */
    
    add_action( 'after_setup_theme', 'catchbase_wpml_invalidcache' );

    before the last ?> PHP closing tag.

    At what stage is “after_setup_theme” being triggered though? Maybe it’s not ?
    I’ll also try to post in Polylang forum, but being the setup of additional content to be translated that easy, I think there must be some step that we’re missing?

    If you got something else let me know please, I’ll get back with news from Polylang too.

    Cheers and thanks 🙂

    #58546
    Sakin
    Keymaster

    @widespread: try adding xml file in your parent theme in public_html/wp-content/themes/catch-base/wpml-config.xml. I am not sure how Polylang works. Here is complete list of XML file https://gist.github.com/sakinshrestha/6cc4ba393ade041c16ae#file-wpml-config-xml

    #58716
    widespread
    Member

    try adding xml file in your parent theme

    tried that, did not work..

    Here is complete list of XML file https://gist.github.com/sakinshrestha/6cc4ba393ade041c16ae#file-wpml-config-xml

    Ok, but isn’t it a description of text strings for the admin interface only, anyway?

    I understand you’re not familiar with Polylang, but then what was the reason for for creating that .xml file in the theme folder (or child-theme folder) ?
    Thanks

    #58731
    Sakin
    Keymaster

    @widespread: That XML is for string translation. See this https://polylang.wordpress.com/documentation/setting-up-a-wordpress-multilingual-site-with-polylang/strings-translation/

    Please post in your site URL as well. Also did you ask in that Polylang support forum.

    #58742
    widespread
    Member

    Hey @Sakin, you only had missed the theme name key, it should have been like this:

    <wpml-config>
      <admin-texts>
        <key name="theme_mods_catch-base-child">
          <key name="catchbase_theme_options">
            <key name="featured_content_headline" />
            <key name="featured_content_subheadline" />
          </key>
        </key>
      </admin-texts>
    </wpml-config>

    Now it works! Thanks for your support!
    Where can I donate you a beer?
    Cheers.

    #58749
    Sakin
    Keymaster

    @widespread: Thanks for the update. Sorry, I missed it. Here is donation link http://catchthemes.com/donate/

    #59276
    Pius
    Participant

    Hi,
    I am a novice to all this building my first webpage, so please apologize my ignorance.

    I have the same problem initially explained in this thread. Now I read trough all this and I am a little confused about the final solution.

    Can you please give me step by step instruction on how to implement the xml file with it’s code that finally worked.

    Also should I create a child theme?

    I am using the latest version of wordpress as well as the latest version of polylang.

    Thanks a lot

    #59277
    Pius
    Participant

    oh sorry and I am using the Full Frame Pro theme

    #59392
    Sakin
    Keymaster

    @Pius: Please wait for some time, we are in the process of making Full Frame Pro theme. we will be to release it within next week.

    #59395
    Pius
    Participant

    Thanks Sakin that’s good news.
    Can’t wait to update and get my new webpage online.

    #59882
    Pius
    Participant

    Hi Sakin,
    can you give me a rough estimate when the update will be available?

    Thanks a bunch.

    #60020
    Sakin
    Keymaster

    @Pius: Sorry for the delay. It will be by this weekend. We are doing final testing.

    #60150
    Pius
    Participant

    Fantastic work Sakin 🙂
    I have a small problem though. I installed Full Frame Pro version 3 on my local machine in my test environment. Everything worked beautifully. I had all the string translation categories available and even the spacing between the logo and the header right is fixed.

    After testing I uploaded V3 via FTP. Then I went to check the strip translation tab. I only had like 3 lines in there, versus the like 20 or so which I had in my test environment. My local test version is practically identical to my online version. Both using a child theme.

    Not sure what to do?

    Thanks a lot for you great work so far.

    #60152
    Sakin
    Keymaster

    @Pius: String translation will show the items that you have entered. It will not show the demo. So, make sure you add in the text first from “Appearance => Customize” and then only check string translation.

Viewing 20 posts - 1 through 20 (of 37 total)
  • The topic ‘Polylang: translating Featured Content title and description’ is closed to new replies.