hussein87
Forum Replies Created
-
Hi @mrfoxtalbot! Thank you for your answer and sorry for my late response.
I appreciate your helpful answer, but I was actually aiming for a slightly different solution. I wanted to find a method that would allow for updates to the blocks in the future, as needed. The approach you suggested converts the reusable block into a regular one, which means it won’t receive any updates made to the original reusable block.
I ended up creating a template part and utilized ACF along with shortcodes to display the values of each individual post’s fields, then used the template part in the single post’s template.
Just in case someone wanted to achieve what I was trying to do, here’s how I solved this:
FIRST: I used JavaScript to loop through attributes and check if
Select
has more than 1 option and add a class to it.let checkSelects = [...document.querySelectorAll(".value select")] checkSelects.forEach(checkSelect => { if (checkSelect.length > 2) { checkSelect.classList.add("active") } })
SECOND: I applied the CSS code to the added class like this:
.value select.active{ display: inline-block !important; }
Now the default Woocommerce dropdown menu is displayed again but we need to the generated radio buttons like this:
.value label:not(:only-of-type){ display: none !important; }
Thanks for the reply!
I understand that, and since the code above is doing the job, I just need to find a way to loop through the attributes and apply the JS code to those, who have more than one option.
All the best,
Hi, thanks for your reply!
The code above works perfectly for me and change the dropdown menu to a radio button.
I was asking, how to make this change only for variations that have only one option (which is selected by default in Woo backend). So if there are multioptions in the variation I want to keep the dropdown menu.
Here’s an image for clarification:
https://snipboard.io/ur8WoG.jpgI appreciate any help!
Hi, that works perfectly, I just changed ‘approved_email’ > ‘welcome_email’ as i wanted to resend that template.
Thank you so much guys for the fast replays and amazing support.
Hi @aswingiri
Thank you so much for your quick answer and for providing the code snippets.
The action has been added to the UM action options list.
However, because of my weak PHP skills, I’m not able to replace custom_action_key and link the UM welcome_email template to the added action.
What else should I update?
I understand custom code is not supported, but I really appreciate your help!
I also noticed differences in the server configuration:
Working server:
Software: LiteSpeed
MySQL version: MySQL Community Server – GPL v8.0.28
PHP Version: 7.4.29Not working server:
Software: nginx/1.18.0
MySQL version: mariadb.org binary distribution v10.5.15
PHP Version: 7.4.29Forum: Plugins
In reply to: [WP Show Posts] Multiple post types in one post listWorked like a charm! ??
Yes, each one has its own taxonomy.Thanks again for your help.
Forum: Plugins
In reply to: [WP Show Posts] Multiple post types in one post listYes, that was the issue ??
Thank you so much for your help!Can I ask one last question please,
I’m trying to add tow custom post type with specific categories from different post types, but it shows only posts from the first category which is “current-affairs” and doesn’t show the other post type category events.here’s the code I’m adding
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) { if ( 4491 === $settings['list_id'] ) { $args['post_type'] = array( 'post', 'tribe_events' ); $args['tax_query'] = array( 'relation' => 'OR', array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => array( 'current-affairs','my-events' ), ), ); } return $args; },10,2);
Forum: Plugins
In reply to: [WP Show Posts] Multiple post types in one post listThanks for the quick replay!
Yes, I did and still getting the same error, it looks like this now
// Start the query $query = new WP_Query( apply_filters( 'wp_show_posts_shortcode_args', $args ) ); $query = new WP_Query( apply_filters( 'wp_show_posts_shortcode_args', $args, $settings ) );
What could be the mistake I’m making here?