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 4 years, 9 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 4 years, 9 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.