marekbo12
Forum Replies Created
-
OK, thank you.
OK, thank you
You can close the subject. Don’t take it personally, but I was under a customer pressure and had to look for an alternative solution.
We can come back to this one day if there are similar problems.Hey, I’m sorry to be so late writing back.
It’s hard for me to say now because I’m using another plugin. However, I remember that there was also a problem with these categories in displaying breadcrumb on the product card – the last categories did not display.I didn’t change the taxonomy.en-US.txt file.
I tried to write my own functions sorting categories and subcategories and there was always the same problem (so your recursive function is correct). In fact, usually this problem occurred with non-english words, but polish alphabet is based on utf-8, so I don’t know why it is a problem.
Which file exactly do you need?@aukejomm OK, thank you for reply.
What parameter should I choose to get then: ‘Cat1 > Subcat1 > Subsubcat2’ ?@aukejomm Can you help me?
@aukejomm
I have a product in the third category level. The function wp_get_post_terms() returns to me an array with three IDs of these categories, but in random order. The recursive function itself omits the last, deepest category.
For example, this product -> https://babyono.com/produkt/lyzeczka-silikonowa-babys-smile/ is nested in: ‘Aktywne Dziecko > Sztućce > Łyżki’, but the Product Category String parameter only shows ‘Aktywne Dziecko > Sztućce’.<item> <g:id>1069</g:id> <title> <![CDATA[ Łyżeczka silikonowa ]]> </title> <g:description> <![CDATA[ <!-- wp:media-text {"mediaId":6226,"mediaType":"image","isStackedOnMobile":true} --> <div class="wp-block-media-text alignwide is-stacked-on-mobile"><figure class="wp-block-media-text__media"><img src="https://babyono.com/wp-content/uploads/2019/04/1069-Z-1-1024x1024.jpg" alt="" class="wp-image-6226"/></figure><div class="wp-block-media-text__content"><!-- wp:paragraph --> <p>Próba samodzielnego jedzenia to krok milowy w rozwoju każdego maluszka. Dając swojemu dziecku do rączek <strong>silikonową łyżeczkę</strong>, znacząco ułatwiasz mu skomplikowane zadanie. Delikatna <strong>łyżeczka silikonowa</strong> została starannie zaprojektowana w taki sposób, aby dopasowywać się do dłoni dziecka. Miękki silikon pozbawiony ostrych krawędzi nie rani dziąseł i nie podrażnia podniebienia. Łyżeczka wyprodukowana jest z bezpiecznych i trwałych materiałów pozbawionych substancji, które mogłyby w najmniejszym stopniu wpłynąć na wrażliwy organizm dziecka.</p> <!-- /wp:paragraph --></div></div> <!-- /wp:media-text --> <!-- wp:media-text {"mediaPosition":"right","mediaId":6266,"mediaType":"image","isStackedOnMobile":true} --> <div class="wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile"><figure class="wp-block-media-text__media"><img src="https://babyono.com/wp-content/uploads/2019/04/1069-Z-2-1024x1024.jpg" alt="" class="wp-image-6266"/></figure><div class="wp-block-media-text__content"><!-- wp:heading --> <h2>WŁAŚCIWOŚCI:</h2> <!-- /wp:heading --> <!-- wp:paragraph --> <p>Delikatna i wygodna</p> <!-- /wp:paragraph --> <!-- wp:list --> <ul><li>ergonomiczny uchwyt, dostosowany do rączek dziecka</li><li>miękki silikon</li><li>zastosowany z myślą o delikatnych dziąsłach dziecka</li><li>idealna podczas nauki samodzielnego jedzenia</li><li>wykonana z trwałych i bezpiecznych materiałów</li><li>nie zawiera Bisfenolu A</li></ul> <!-- /wp:list --> <!-- wp:heading --> <h2>DANE TECHNICZNE:</h2> <!-- /wp:heading --> <!-- wp:paragraph --> <p>W ZESTAWIE:</p> <!-- /wp:paragraph --> <!-- wp:list --> <ul><li>łyżeczka 1szt</li></ul> <!-- /wp:list --></div></div> <!-- /wp:media-text --> ]]> </g:description> <g:google_product_category> <![CDATA[ Baby & Toddler ]]> </g:google_product_category> <g:product_type>Aktywne dziecko > Sztućce</g:product_type> <link> https://babyono.com/produkt/lyzeczka-silikonowa-babys-smile/ </link> <g:image_link> https://babyono.com/wp-content/uploads/2019/04/1069-Z-2.jpg </g:image_link> <g:price>9,49 PLN</g:price> <g:condition>new</g:condition> <g:availability>in stock</g:availability> <g:brand>Babyono</g:brand> <g:gtin>5901435407912</g:gtin> <g:adult>no</g:adult> <g:identifier_exists>yes</g:identifier_exists> </item>- This reply was modified 6 years, 3 months ago by marekbo12.
@aukejomm I think something with recursion function is wrong here:
public static function make_shop_taxonomies_string( $product_id, $tax = 'product_cat', $separator = ' > ' ) { $args = array( 'taxonomy' => $tax, 'orderby' => 'parent', 'order' => 'DESC', ); // get the post term ordered with the last child cat first $cats = wp_get_post_terms( $product_id, $tax, $args ); $result = array(); if ( count( $cats ) === 0 ) { return ''; } // anonymous function to get the correct taxonomy string $cat_string = function ( $id ) use ( &$result, &$cat_string, $tax ) { // get the first term $term = get_term_by( 'id', $id, $tax, 'ARRAY_A' ); // check if the term has a parent if ( $term['parent'] ) { // start the anonymous function again with the parent id $cat_string( $term['parent'] ); } // add the terms name to the result $result[] = $term['name']; }; // activate the anonymous function with the first categories term_id $cat_string( $cats[0]->term_id ); return implode( $separator, $result ); }in ‘class-wppfm-taxonomies.php’ file.
Try to return this function in single-product.php and you will notice that the deepest category is omitted.- This reply was modified 6 years, 3 months ago by marekbo12.
Forum: Plugins
In reply to: [Advanced Editor Tools] Custom Styles doesn’t workmy array looks like this right now:
`$style_formats = array(
array(
‘title’ => ‘Podtytuł do sekcji H4’,
‘format’ => ‘h4’,
),
array(
‘title’ => ‘Śródtytuł do sekcji H5’,
‘format’ => ‘h5’,
),
array(
‘title’ => ‘Tytuł zdjęcia i tabelki’,
‘format’ => ‘h6’,
),
array(
‘title’ => ‘Źródło’,
‘block’ => ‘h6’,
‘classes’ => ‘zrodlo’,
),
array(
‘title’ => ‘Tekst wyróżniony’,
‘block’ => ‘p’,
‘classes’ => ‘tekst-wyrozniony’,
‘wrapper’ => false,
),
array(
‘title’ => ‘Zwykły paragraf’,
‘format’ => ‘p’,
),
);`
I don’t know exactly why this works now, but probably because of better understanding how works ‘format’ and ‘block’.Forum: Reviews
In reply to: [LLM Hubspot Blog Import] Worked like a MagicHello. What about categories, tags, images – have these elements also been imported?
Forum: Plugins
In reply to: [WP Post Popup] Javascript does not loadin <head>, I use Simple Custom CSS and JS plugin to add JS
Forum: Plugins
In reply to: [WP Post Popup] Javascript does not loadThanks for quickly reply!
I am not sure if I understand you. I load content to popup from post. In this post I have simple SVG map. I have jQuery script, which makes various changes when you click on map. It works when I am in post page, but when content from this post is loaded in popup – nothing happened. When popup is shown, there is no html code when I click ctrl+u (in chrome) to choose source code page. I added php code to functions.php from your link above and enable legacy mode, but nothing happened. What I can to do also?Forum: Plugins
In reply to: [WP Post Popup] Javascript does not loadI have this same problem. jQuery doesn’t work, because content from popup is not visible in source code – thats my opinion. What I have to do?
Forum: Plugins
In reply to: [ACF Photo Gallery Field] Gallery doesn’t display on some pages.Hey.
I resolved this problem on my own.
The problem was with Polylang plugin. In Polylang plugin setting was enabled multilingual support for media. This should be turned off. You can do this by unchecking the ‘Activate languages and translations for media’ option, in the settings area of the Polylang plugin. And it works now.