Forum Replies Created

Viewing 15 replies - 46 through 60 (of 74 total)
  • Thread Starter Marc

    (@arbolife)

    Hi Jeff,

    I’m not a coder, so I don’t have the credentials to be recommending anything. However, I noticed that all the strings are sent for translation using this format:
    esc_html_e('Upload an Image', 'usp');
    And the comment from the setting uses a simple echo (which would not send it to the translation function):
    echo $usp_options['upload-message'];
    Should it look more like this ?
    esc_html_e($usp_options['upload-message'], 'usp');

    Best,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Jeff,

    OK that worked and will prevent it from getting erased. However it’s weird that everything else translates fine on the form other than the image comment that I entered in the settings.

    Best,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Jeff,

    Thanks, I missed it. In case someone has the same need here’s what I added to my functions.php:

    add_filter('usp_require_login', 'kleo_modal_login_usp');
    function kleo_modal_login_usp($output) {
        $output = preg_replace('/<a([^>]+)href=\"http\:\/\/([a-z\d\-]+\.[a-z\d]+\.[a-z]{2,5}(\/[^\"]*)?)\">/i', '<a class="kleo-show-login" href="#">', $output);
        return $output;
    }

    Thanks,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Jeff,

    I’m using the free version of USP.

    Thanks,
    Marc

    Hi,

    Thanks Danny for finding this and reporting it to SendinBlue.

    @SendinBlue, our site is affected by this issue when using a SendinBlue mailing list subscription form inside a Boxzilla pop-up window. Could you please let me know if there’s a new version of the plugin to test?

    Best,
    Marc

    Also interested in examples on how to do that…

    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    Thanks I submitted it on GitHub.

    Cheers,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    Thanks for you answer. This is “convenient” for me, no problem for waiting until this can be sorted out.

    I looked at the bug link you sent and it made me wonder about one more improvement I could include in my code (but would need a pointer about how to achieve it). Could I make part of my customized title & description be a floating prefix in the backend ?

    For example if my generated description is like this: <meta property=”og:description” content=”Rue Pré-du-Marché 13, Lausanne, Switzerland – Vegetarian, vegan options, organic food | La Cuisine propose des boissons chaudes, dont un délicieux Tcha? maison, à…”>, I’d like to have this part “Rue Pré-du-Marché 13, Lausanne, Switzerland – Vegetarian, vegan options, organic food | ” be a floating prefix so users can adjust only the comment part in the back-end without retyping the whole first part.

    Would this be another filter to use ?

    Best,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    Thank you so much, that was really useful. I’m not a developer, but it’s fun to poke around with code. I’ve got a version working to change the title & description of all GeoDirectory custom post types and switching between English and French using WPML. Here’s my code:

    /******************************************************************
     * Edit the title for both the header and social networks
     ******************************************************************/
    add_filter( 'the_seo_framework_pro_add_title', 'arbolife_custom_title', 10, 3 );
    
    function arbolife_custom_title( $title = '', $args = array(), $escape = true ) {
        global $post;
        $blogname = the_seo_framework()->get_blogname();
        $separator = the_seo_framework()->get_title_separator();
        
        // Get the current post type
        $post_type = get_post_type( $post->ID );
        
        // Get all the GeoDirectory post types
        $all_gd_post_type  = geodir_get_posttypes();    
        // If the post type is a GeoDirectory post type & we're not in a category page
        if ( in_array($post_type, $all_gd_post_type, true) ) {
    		$post_type_obj = get_post_type_object( $post_type );
    		if ( isset( $post_type_obj->labels ) ) {
    			$post_type_name = $post_type_obj->labels->singular_name;
    		} else {
    			$post_type_name = '';
    		}
        
            $directory_name = __( '%s Directory', 'arbolife-seo' );
            $directory_full = sprintf($directory_name, $blogname); 
            
            // If there is a city AND a post type name 
            //   AND the page is not an archive (displaying a cateogry)
            //   AND the page is not a search result
            if ( $post->post_city && $post_type_name && !is_archive() && !is_search() ){ 
                $type_in_city = __( ' - %s in %s', 'arbolife-seo' );
                $post_type_location = sprintf($type_in_city, $post_type_name, $post->post_city); 
            // Same as above but no city (most likely online store)    
            } else if ( $post_type_name && !is_archive() && !is_search() ){
                $post_type_location = sprintf( ' - %s', $post_type_name);
            } else {
                $post_type_location = '';
            }
    		if ( $post_type_name ) {
    			$replacement = sprintf( '% s%s %s %s', $post->post_title, $post_type_location, $separator, $directory_full );
    			$title = str_replace( "$blogname $separator", $title, $replacement );   
    		}
    	}
    	return $title;
    }
    
    /******************************************************************
     * Edit the description for both the meta tag and og for social networks
     ******************************************************************/
    add_filter( 'the_seo_framework_description_output', 'arbolife_custom_description', 10, 3 );
    add_filter( 'the_seo_framework_ogdescription_output', 'arbolife_custom_description', 10, 3 );
    
    function arbolife_custom_description( $description = '', $args = array() ) {
        global $post;
        
        // Get the current post type
        $post_type = get_post_type( $post->ID );
        
        // Get all the GeoDirectory post types
        $all_gd_post_type  = geodir_get_posttypes();    
        // If the post type is a GeoDirectory post type & we're not in a category page & not in search page
        if ( in_array($post_type, $all_gd_post_type, true)  && !is_archive() && !is_search() ) {
    		
      
            // If there is a city (not an online store) 
            if ( $post->post_city ){ 
                $country_name = __( $post->post_country, 'arbolife-seo' );
                $post_location = sprintf( '%s, %s, %s - ', $post->post_address, $post->post_city, $country_name ); 
            // Same as above but no city (most likely online store)    
            } else {
                $post_location = '';
            }
            
            // Get the list of categories
            $post_tax = $post_type . "category";
            $post_categories = $post->{$post_tax};
            if (is_array($post_categories)) {
                $post_categories = implode(', ', $post_categories);
            }
            $cats_arr = array_filter(explode(",", $post_categories));
            $category_list = '';
            foreach ($cats_arr as $cat) {
                $term_arr = get_term($cat, $post_tax);
                if ( !empty($category_list) ) {
                    $category_list .= ', ';
                }
                $category_list .= strtolower($term_arr->name);
            }
           
            // Collate location and categories and create exceprt 
            $initial_replacement = $post_location . ucfirst($category_list);
            $excerpt_length = 170 - strlen($initial_replacement);
            $post_excerpt = text_truncate($post->post_content, $excerpt_length);
            
            // Put the final description together
    		$description = sprintf( '%s | %s', $initial_replacement, $post_excerpt );   
    	}
    	return $description;
    }
    
    /******************************************************************
     * Function to truncate a post description
     ******************************************************************/
    function text_truncate($text,$numb) {
    if (strlen($text) > $numb) { 
      $text = substr($text, 0, $numb); 
      $text = substr($text,0,strrpos($text," ")); 
      $etc = "...";  
      $text = $text.$etc; 
      }
    return $text; 
    }

    The only problem I found is that in the wp-admin area, when viewing a French listing, the title shows with the English wording (“Directory” instead of “Annuaire”, “Store” instead of “Magasin” and “in” instead of “à”. Here’s a screenshot. It’s strange that it works on the frontend, but not the backend, can this be fixed somehow?

    Next I’ll move to fixing the images.

    Best,
    Marc

    • This reply was modified 7 years, 9 months ago by Marc.
    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    I sent you the screenshots on the link you provided.

    Best,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    Thanks for the update. I updated my site and removed the title and description from the home page section of SEO Framework. It did solve the problem number 1 (I now translated the title of the site using WPML string translation. But it still hasn’t resolve the other issue of the one page for which it doesn’t work: https://www.arbolife.com/fr/services/ still gets the English version despite being set in French in the back end.

    Best,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    Fantastic. Let me know if you want access to my site. If so, you can leave your details on the contact form of https://www.arbolife.com/ (bottom right floating enveloppe).

    Happy New Year to you as well !!

    Best,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi Sybre,

    Stiofan helped my solve the duplicate description & keywords that were added by GeoDirectory (not my theme in the end): https://wpgeodirectory.com/support/topic/secondary-description-and-keywords-meta-tags/

    Do you prefer I open a new thread to continue discussing the multilingual issue ?

    Best,
    Marc

    • This reply was modified 7 years, 11 months ago by Marc.

    Hi @kirit-dholakiya,

    Thank you, this is great progress. Now it works in English, but the name of the payment gateway still doesn’t save the translated version. My default title is “Credit Card” and right below I put the French version “Carte de crédit”, when I save the English gets saved but the French disappears. The French site then also mentions “Credit Card” instead fo “Carte de crédit”.

    Would it be possible to fix this as well please ?

    Thank you,
    Marc

    Thread Starter Marc

    (@arbolife)

    Hi,

    I know it’s terrible. I had to do it because I found no other way. I have a mile long functions.php with filters to translate the plugin’s output. Really ugly, but I was under a deadline. The site is a “landing page” in 2 languages with a form to sign-up, so performance doesn’t seem to be an issue.

    I did try PDB_MULTiLINGUAL and used any gettext filters I could find, I never got to the field headers. I spent half a day trying to make it work and failed miserably.

    With this ugly method, I managed to translate the whole plugin’s output, except for the email sent to participants. Any idea how to do that?

    I’d be more than happy to experiment a cleaner way and let you know so you can document how to do it. I’m not a coder but am literate enough to make things work from examples, so I’d need some pointers on how to get started. I thinks this is really missing, you claim your plugin is multilingual but nobody I found managed to make it work with whether it be with WPML, Polylang or even gettext filters.

    Thanks,
    Marc

    • This reply was modified 7 years, 11 months ago by Marc.
    • This reply was modified 7 years, 11 months ago by Marc.
Viewing 15 replies - 46 through 60 (of 74 total)