Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter flavcao

    (@flavcao)

    Yes, I am using the latest version of both plugins.

    And yes, I tried using the newest way they have for translating:
    [:en]Text[:fr]text[:]

    I also tried with the HTML comment <!–:en–> …

    I tried putting those directly in the input for the label in the map configuration, but when saved all the extra would just be wiped out.

    There isn’t a toggle button for the language in the page either, which is the usual behaviour of qTranslateX.

    I thought of doing the translation .pot file as explained for WPML in the website: https://wpstorelocator.co/document/translations/
    but don’t think the same will apply for qTranslateX – or at least don’t know how it would!(?)

    Thread Starter flavcao

    (@flavcao)

    Hi Ankit,

    Thank you for your help. With your tip I managed to get the extra fields in the table using the implode and array_push method to store the information as an array.

    The code works for the purposes I need now.

    I was just wondering if you could give an insight for the table columns headers.

    I can add one header “Extra Fields” using the function:

    function wpg_add_columns($cols) {
    
    	$cols['wc_settings_tab_extra_fields'] = __('Extra Fields', 'my_theme');
    	return $cols;
    
    }
    add_filter('wpg_order_columns', 'wpg_add_columns');

    This way I have only one header and all the extra fields are being printed to the csv file in separate columns.

    I’m trying to somehow loop the writing of the header, something like:

    function wpg_add_columns($cols) {
    	for($i = 1; $i <= 20; $i++){
    		$cols['wc_settings_tab_extra_names'] = __('Extra Name'.$i , 'face3_theme');
    	}
    		return $cols;
    }
    add_filter('wpg_order_columns', 'wpg_add_columns');

    Does it make sense?

    I tried something like the adding to the csv file:

    function wpg_add_columns($cols) {
    
    	$extra_columns = array($names, $emails);
    	for ($i=1; $i <= 20; $i++) {
    		$names = (array)__( 'Participant '.$i.' Name', true );
    		$names = implode(" , ", $names);
    		$emails = (array)__( 'Participant '.$i.' Email', true );
    		$emails = implode(" , ", $emails);
    		array_push( $extra_columns, $names, $emails );
    	}
    
    	$cols['wc_settings_tab_extra_fields'] = __($extra_columns, 'my_theme');
    	return $cols;
    
    }
    add_filter('wpg_order_columns', 'wpg_add_columns');

    But that prints “Array” to the csv file. Everything works normally.

    Could you give a little light on how to loop the writing of table headers for the same field?

    Thanks for any insight, if you can.

    Thread Starter flavcao

    (@flavcao)

    Hi Ankit,

    Thank you very much for your response.

    Unfortunately I think the solution with array won’t work on my case, as each new ‘extra name’ is being stored as a new column on the table (not one column with an array of names – multiple columns).

    My idea is that somehow I’d need to be able to test is the column has content and if yes print it to the .csv file, if not than keep moving through each until it’s completed. The problem I’m facing is never knowing how many ‘extra names’ (therefore extra columns).

    It sounds a lot like a while loop may be a solution (one solution), but then again, I’m not that experienced to put this in code.

    I’ll keep trying.

    Thanks again, appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)