Forum Replies Created
-
AuthorPosts
-
July 19, 2019 at 8:07 am in reply to: How to add something into the burger (mobile) menu on the fly? #1120087
I have 2 menus . One is main menu and the second one is secondary menu. On mobile, the enfold burger menu only shows the menu items from the main menu. I want to hide the secondary menu on mobile and append all the menu items from secondary menu to the burger menu.
I tried to add the following javascript to the header:
<script type=”text/javascript”>
jQuery(document).ready(function() {
var updatedMobileMenu = false;
jQuery(‘span.av-hamburger’).on(‘click’, function(){
if (jQuery(‘span.av-hamburger’).hasClass(‘is-active’)){
// nothing to do
} else {
setTimeout(function(){
if (updatedMobileMenu == false){
var topMenu = jQuery(‘#avia2-menu’).clone();
jQuery(‘#av-burger-menu-ul’).append(jQuery(topMenu).children());
updatedMobileMenu = true;
}
}, 500);
}
});
});
</script>It appends the secondary menu items to the burger menu successfully. However, the style is completely difference from other menu items on the burger menu. I found that the burger menu item structure is completely difference and I can’t directly clone and append them. Is there any javascript function which I can use to create mobile menu items on the fly?
Thanks,
AlexI dont want to disable the php warning as it helps me to do some debugging and monitoring. However, the log file getting big really fast. It increased around 30MB per days and make me hard to see the actual error it has. I would like to fix it if possible. Any idea on what’s happened?
I moved it to another server. Let me know if you need any login.
any news?
I found the solution here: http://kriesi.at/documentation/enfold/use-the-layout-builder-with-any-post-type
with the type “enhancedcategory”
Got it. Thanks!
I thought this is the problem from Advanced LayerSlider as other content is working in the preview. But thanks for your reply. I will try to explain to my customer.
- This reply was modified 8 years, 10 months ago by boscotwcheung.
Do you know that will this be fixed or not in the coming update? I asked my customer to clone the page for the “preview changes” so that the original page can still be public and able for them to preview the changes at the same time. But they are not satisfied with this solution.
I updated the theme but still have the same problem. I made a sample wordpress site for you to try. Please try to add an “Advanced LayerSlider” to the homepage, press the “Preview Changes” button (don’t press the “Update” button before it). You will only see an empty area in the preview page. You can only see the slider display properly after pressing the update button.
This should because I replaced the image to 1920px. So, it “looks” fixed. But I set the slider width to 1290, adding a 1290px image should work as well but it is not. See the attached link for screenshot and I made a test page and slider for showing this problem.
I updated the slide 4 image to a wider images (1920 x 650px) to make it “looks” fixed for my customer first. I still need the solution for this.
sent. Thanks
I found a plugin which can do similar things for a page
yes. So, it will
1. load an empty style.css by default in wp_head function
2. load the custom css (with file time as parameter) ONCE with all my custom css on it by adding some code in function.phpYou still need to ask your customer to clear the browser cache ONCE after this update. But no more clear is needed after this.
I fixed the problem by adding custom.css into the child theme and add the following to the function.php
function css_versioning() {
wp_enqueue_style( ‘custom-css’, get_stylesheet_directory_uri() . ‘/custom.css’ , false,filemtime( get_stylesheet_directory() . ‘/custom.css’ ), ‘all’ );
}
add_action( ‘wp_enqueue_scripts’, ‘css_versioning’ );I still not able to resolve it. I did a day research and looks like that this problem can not be solved. You can see the link I posted in chrome for how the table should be. What do you means by grid row?
Yes. This is almost what I needed. But I need to support multiple message which can be automatically switch to next message (and button) for every few seconds.
here should be what the script do,
1. get a list of products
2. call custom_product_save($post_id) for each product idYes, you need to add “isHot” custom field and value to all the product first. A script is needed to do a batch for this.
add this to function.php
add_action( ‘wp_insert_post’, ‘custom_product_save’ );
function custom_product_save($post_id){$post_type = get_post_type( $post_id );
// check if post type is a product
if ($post_type == ‘product’){
// add isHot custom fields based on the value of “_featured”
$isHot = get_post_meta($post_id, ‘_featured’, true);
if ($isHot){
update_post_meta($post_id, ‘isHot’, ‘Hot’);
} else {
update_post_meta($post_id, ‘isHot’, ‘Normal’);
}
}}
// Sort the product by hot item first and A to Z after that
add_filter( ‘woocommerce_get_catalog_ordering_args’, ‘custom_woocommerce_get_catalog_ordering_args’ );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
$args[‘meta_key’] = ‘isHot’;
$args[‘orderby’] = ‘meta_value title’;
$args[‘order’] = ‘ASC’;
return $args;
}However, you need to update all the existing product to add the isHot custom fields. (should be easy to write a script to do a batch update)
I changed “_featured” to a custom field.
I did a do_action(‘wp_insert_post’, ‘xxx’). I will create a custom field called “isHot” based on the “_featured” value when saving the post.
The logic are:
if (“_featured” == true){ “isHot” = ‘Hot’;} else {“isHot” = ‘Normal’;}And now, I can sort by “isHot” and ‘title’ in ASC. The hot item will show first and then A to Z
Thanks,
AlexI found it can be done by the custom field. But I need to think a better custom field value for “isFeatured” as it also sort from A to Z…
Anyway, the technical problem is solved. You can close this thread. Thanks.
If I change the featured to a custom field, can this be sorted? e.g. If I created a custom field “isFeatured” and the value is “YES” or “NO”, can I sort by this custom field and then sort from A to Z?
This is a request from a customer. They have a lot product and it is hard to sort by drag and drop now. They want to hardcode the sorting.
Well…I tried this before. I will show product from A to Z but the featured product will be at the end of the list. I want the featured product on top and sort from A to Z after that.
Edited (I tried the following before):
add_filter( ‘woocommerce_get_catalog_ordering_args’, ‘custom_woocommerce_get_catalog_ordering_args’ );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
$args[‘meta_key’] = ‘_featured’;
$args[‘orderby’] = ‘meta_value title’;
$args[‘order’] = ‘ASC’;
return $args;
}- This reply was modified 9 years, 2 months ago by boscotwcheung.
Thanks. I used it in the textblock because I need to add the image into a “non-even-column” width table. I can only do this in textblock as I know. I can add the image shortcode. However, this is a bit hard for non-tech user to update the content. So, I would see if there is any user friendly way to do it.
I think this can be closed. Thanks.
Thanks
Thanks
Thanks
I still having the problem. But the workaround is working, so this thread can be closed. Thanks.
-
AuthorPosts