tlouwet
Forum Replies Created
-
Already done ??
Keep up the sweet work.
@drosendo Sweet thanks!
Oh the meta of the main product.
Retrieved from an example:
a:2:{i:0;a:2:{s:5:"slugs";a:1:{i:0;s:6:"orange";}s:4:"imgs";a:1:{i:0;s:4:"2811";}}i:1;a:2:{s:5:"slugs";a:1:{i:0;s:5:"black";}s:4:"imgs";a:1:{i:0;s:4:"2814";}}}
Where I see 2814 as the image id for “black”.
Sadly I’m not accustomed to this format.Got this to echo the wanted image:
$meta_variations = get_post_meta($product->get_id(),'woosvi_slug')[0]; foreach ($meta_variations as $variation) { if ($variation['slugs'] == ['black']) { echo wp_get_attachment_image($variation['imgs'][0]); } }
Would this be the correct way to do it?
And really appreciate the help!
Hi @drosendo
Yeah was wayyy late at night, I could have phrased it better.
Is there a way to call upon the gallery of a product’s variation, outside of the product page?
Lets say I have a product that has a few variations, attribute_pa_color orange blue and black, but I want to get the gallery of just the black one, is there a function I can use to get those?Thanks for the quick reply.
@tristantrx It would seem it does not know what “en” refers to, or that “en” is seen as a mistyped variable.
Only thing I could think of is, do you have english a language with translatepress?$dictionary_name = $this->trp_query->get_table_name( “nl” );
is what I have to use.
Reason I’m using “nl” is because the main language of the website I had this issue with was Dutch, hence nl.hi @nayeeem
I’ve played around with these 2 settings, strict is closest, but not exactly.
What I’m trying to do is the moment a student finishes a quiz, the course is automatically set to “completed”, so they don’t need to do it themselves.
Some students get confused about having to click the “complete course”.
– Some afraid they’re doing something wrong
– Some thinking the website didn’t register their quiz result(s) correctlyIf the course was set to “completed” the moment they finished the quiz, it would remove those confusions (or atleast I hope ^^).
Thanks for your time
Forum: Plugins
In reply to: [Customer Email Verification for WooCommerce] Language detection for emailsOh perfect!
Great to hear.Forum: Plugins
In reply to: [Tutor LMS - eLearning and online course solution] Cancel Course EnrolAnd found where the information was held, wpvk_comments.
WHERE comment_agent = 'TutorLMSPlugin' AND comment_type = 'course_completed' AND comment_post_ID = {$course_id} AND user_id = {$user_id}
Removing the associated row brings the course back into active-courses.
Guess I should’ve read through Utils() a bit longer ^^
So issue solved.
Thanks for your time as always.
Forum: Plugins
In reply to: [Tutor LMS - eLearning and online course solution] Cancel Course EnrolSure thing.
And keep up the good work ??Forum: Plugins
In reply to: [Tutor LMS - eLearning and online course solution] Cancel Course EnrolHi @badsha_eee
I have just deleted the usermeta _tutor_completed_lesson_id_14010 and _tutor_completed_lesson_id_14011, the id of the 2 lessons in the course, though removing those 2 only removes the checkmark next to the lesson.
Will be adding this to the remove-course action, I overlooked this.$lesson_ids = $wpdb->get_col("select post_id from wpvk_postmeta WHERE meta_key = '_tutor_course_id_for_lesson' AND meta_value = {$course_id}"); foreach ($lesson_ids as $lesson_id) { $wpdb->delete( 'wpvk_usermeta', array( 'user_id' => $user_id, 'meta_key' => '_tutor_completed_lesson_id_'.$lesson_id) ); }
Noticed _lesson_reading_info also holding some info on the course, removed it too but no change there.
After removing and re-adding the course to the user afterwards, the course still shows up in completed-courses instead of active-courses.
I’ve looked through usermeta to find anything related to the course id, but no luck there.
And glad to hear ??
- This reply was modified 4 years, 9 months ago by tlouwet.
Forum: Plugins
In reply to: [Translate Multilingual sites - TranslatePress] Get translated string@robert7k and thanks for the lead.
Noticed the function was getting it’s query from class-query.php,
wherein function process_strings pretty much does what process_strings does. Though that function does sort of note where the translations were kept.$title_fr = $wpdb->get_row("SELECT * from wpvk_trp_dictionary_nl_nl_fr_fr WHERE original = '{$original_name}'")->translated;
gives me the french translation of $original_name (does require ‘global $wpdb;’)Table name will probably be different for you, which you could find in your sql.
For me (mostlikely for you too), is a table with column names: id, original, translated, status, block_type, original_id.Will probably do it that way as for what I’m working on it already uses $wpdb.
- This reply was modified 4 years, 9 months ago by tlouwet.
Forum: Plugins
In reply to: [Translate Multilingual sites - TranslatePress] Get translated stringReally nice find @robert7k
It does the trick.
(for my use I did change get_locale() to an array and cycled it)Small note, ‘target_language’ doesn’t have a $ under $translation in your posted code. But I assume that’s just an example error.
Sadly I’m not that knowledgeable when it comes to sql injections.
I guess you mean that I should protect/sanatize the $original_name?
I’m pulling the page id from a GET[] > sanatize it > get_the_title(). Should be sufficient?And I appreciate the help.
Forum: Plugins
In reply to: [Translate Multilingual sites - TranslatePress] Translate logo ONLYMy reply was a template-only solution, no need for functions.php editing.
For example if it’s an image in the header you wanted to change, you edit it in the header.php (obviously depends on what plugins you’re using).
If you can’t edit the template, but you are able to exchange the image with a shortcode, you could reach a solution that way.
function exchange_image_function() { if (get_locale() == 'nl_NL') { echo '<img src="imgLogo.jpg">'; } elseif (get_locale() == 'fr_FR') { echo '<img src="imgLogo2.jpg">'; } } add_shortcode('exchangeImage', 'exchange_image_function');
in functions.php
src=”imgLogo.jpg” ofcourse needs to be the url to the image.Above will be called with [exchangeImage].
If you can’t add a shortcode instead of the logo, sadly that’s the limit of my php knowledge.
Not from support, but to center it or change visuals it’s css.
To center it for all browsers, add this to your css:
#trp-floater-ls { left: 50%; left: calc(50% - 25px); }
This will center the left side of the language picker on browsers that do not compute calc().
And browsers that do compute calc(), it will be centered, as the language picker is 50px wide.To make the background transparent, change it to this:
#trp-floater-ls { left: 50%; left: calc(50% - 25px); background-color: transparent; }
On hover, your language picker displays shadows, to remove this, add this to your css too:
#trp-floater-ls:hover { box-shadow: none; }
On hover, your language picker also darkens the background on the selectable language, if you want that gone, add this to your css:
#trp-floater-ls-language-list a:hover { background-color: transparent; }
Do note, you’ll need to CTRL+F5 while watching the page to see the change, because browsers save the css locally, CTRL+F5 removes it from the browser.
If you want small changes that can be done through css, and you use for example chrome/firefox, right click what you want changed > inspect, and see what css applies the effect you want to change.
Probably better guides online than what I could write down here.This way you can apply css changes to things all over your website.
Hope this helps.
If you run into an issue, just reply here and I’ll reply as soon as I can.Forum: Plugins
In reply to: [Translate Multilingual sites - TranslatePress] Translate logo ONLYI’m not from support, but if you know where to find the placement of the image in php, you could use
if (get_locale() == 'nl_NL') { echo ''; } elseif (get_locale() == 'fr_FR') { echo ''; } elseif...
And echo the element you want for that language.
For example if you have
<img src="imgLogo.jpg">
for nl_NL and you want to swap it to imgLogo2.jpg for fr_FR, you can apply thisif (get_locale() == 'nl_NL') { echo '<img src="imgLogo.jpg">'; } elseif (get_locale() == 'fr_FR') { echo '<img src="imgLogo2.jpg">'; }
get_locale() is a function WordPress uses to check which language is viewed.
This does not require TranslatePress, just the use of WordPress, so you won’t have TranslatePress messing something up.- This reply was modified 4 years, 9 months ago by tlouwet. Reason: changed 'return' to 'echo'