This is my first post, so please be gentle. I'm already successfully executing some jQuery codes in my woocommerce cart-page after updating the item quantity (Ajax) with the following code: $( document.body ).on( 'updated_cart_totals', function(){ //re-do your jquery }); I also need a similar function to execute a jQuery code after adding a cross selling item (with click on the ajax_add_to_cart_button) in the cart-page. So far i checked the cart.js file to find a custom event to handle this - …
Wordpress admin dashboard only shows the current and upcoming events, but there's seemingly no way to access the past events through admin dashboard. The event page on admin dashboard (wp-admin/edit.php?post_type=event) tells me that there are 146 events in total but only show 19 (current/upcoming) and there seems to be no way to change filtering/options to show all events. I feel like I have to be missing something incredibly obvious here.
I guess this should be a very simple question, but I'm not too familiar with overall functioning of Wordpress / TinyMCE so I'm struggling: I've added a custom button to TinyMCE and need some kind of reference to a corresponding DOM element that would enable me to set a function handler for the 'click' event. Every click should dynamically change some other parts of the TinyMCE editor so I also need to refresh ('reflow'?) the view somehow. Among answers to …
Is there a way to trigger the post saving or updating event in code? such as do_action('save_post', $post_id); The function here seems to imply that a WP_POST object needs to be passed in. Is there a way to basically imitate the action of updating the post with all its existing values. The point is for the other hooks linked to all trigger on post update. Maybe do a wp_insert_post(), just passing in the post id? https://developer.wordpress.org/reference/hooks/save_post/ do_action( 'save_post', int $post_ID, …
I'm using the plugin Modern Events Calendar Lite. This is a recent plugin, so actually no doc exist. So i'm looking a way to display my upcoming events on homepage. But i can not make it to work, because start is stored in a second table. So i have a wpquery that list custom posts "mec-events", this is ok. But i'm not able to JOIN info to second table to get start_date & to order posts on its value. I …
I my project I have the events page where it display all the upcoming events according to the dates. But my client needs to have one more category called "Past events", where all the past events should be stored there. So that when the event expires it has to go that particular past event category. Can anyone suggest me how to achieve this? Help needed.
I'm having an issue where events that I have scheduled work for a while then just stop. After looking at the event queue I see that the scheduled events are no longer in the queue. If I deactivate then reactivate the plugin the schedule is back and works for a period of time. I don't know if WordPress has something that removes events if they timeout or anything like that. Here is my code: register_activation_hook(__FILE__, 'k2_section_featured_ads_setup'); function k2_section_featured_ads_setup() { wp_schedule_event('1395871200', …
I am using events ticket plus plugin and i have created events ticket but for some reason i need to update the price of a ticket when adding to cart and checkout page. I have used this code. add_action( 'woocommerce_before_calculate_totals', 'misha_recalculate_price' ); function misha_recalculate_price( $cart_object ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; foreach ( $cart_object->get_cart() as $hash => $value ) { $pid=$value['product_id']; $value['data']->set_price(10 ); } } This code is working for all normal products (setting …
I'm using WooCommerce hook added_to_cart which works perfectly in jQuery, but doesn't work in vanilla Javascript. Both functions are running on document loaded. Here is my code reference: JavaScript ajaxAddToCart: function () { document.body.addEventListener("click", function (e) { if (!e.target.classList.contains("add_to_cart_button")) return; // This event doesn't work document.body.addEventListener("added_to_cart", function () { console.log("added"); setTimeout(function () { added.classList.add("button"); added.innerHTML = `<span class="text">${wc_cart_fragments_params.i18n_view_cart}</span> <span class="icon">check</span>`; }, 100); }); }); }, jQuery $(document).on("click", ".add_to_cart_button", function (e) { // This event works $("body").on("added_to_cart", function () { console.log("added"); …
I am creating custom post type eventlist filter form. There is two options: category and months. Following this advice List events by month I got display event categories by month. Meaning... January Event post 1 Event post 2 February Event post 1 Event post 2 etc. Category choosing works smoothly. Problem comes up when user choose month. By default events are listed by month. How can I reorder events using form options? Is it possible solve using meta_query compare or …
Have few pages in wordpress cms. Whenever any page is published or updated, there is need to do some action (basically call an API to update some data in another backend service). For publish, I am able to identify the point and able to trigger action one time For update, I am not able to identify the point and hence, even if I update the page once, the action is getting trigerred more than once. Is there a way to …
How do I pass arguments to my hook function? my_function($arg1, $arg2){ echo $arg1 . " " . $arg2; } add_action( 'init', 'my_function'); If I want my_function to echo "hello world" for instance, how would I send those parameters with the action hook?
I'm trying to create an events page that lists events (custom post type) within the week. I'm having trouble properly selecting only the posts that have a 'start_date' that falls in the current week. Here is my code: $day = date('w'); $week_start = date('d-m-Y', strtotime('-'. $day . ' days')); $week_end = date('d-m-Y', strtotime('+' . (6 - $day) . ' days')); $args = array( 'post_type' => 'hcc_events', 'order' => 'ASC', 'meta_key' => 'start_date', 'orderby' => 'meta_value', 'posts_per_page' => -1, 'meta_query' => …
How onthisday.com has been made? I'd want to make something similar. I guess I need to have a database with some events happened in a day (6 february 2021, 6 february 2020, 6 february 2019 ... 6 february 2014) and then I want to show all the events happened on that day. I have no idea on how to start and I'll appreciate any help. Thanks
Does anyone know if there's a list of all JavaScript events for widgets? I know there are other lists (e.g. Woocommerce; wp.media) but I'm looking for one specifically for widgets. It took me a bit of time to find events like widget-updated and widget-added but are there more than just those two? Any advice or recommendations would be greatly appreciated. Cheers!
I'm new around here but I will do my best to get the question out as clear as possible. I'm developing a website where users will be able to publish portfolio items from the front-end of the website. The portfolio item contains a title, content, featured image and image gallery. To prevent a certain user from spamming the site and uploading lets say 100 images in 1 portfolio item, i have added some limits like the max size for an …
The goal I want to use wp_schedule_single_event( ) to execute a single event that sends me an e-mail 8 minutes after the user submits a form. The issue The following code is in my functions.php: function nkapi_send_to_system( $args ) { wp_mail( 'xxx', 'xxx', $args ); } add_action( 'nkapi_send', 'nkapi_send_to_system' ); function schedule_event( $id ) { wp_schedule_single_event( current_time( 'timestamp' ) + 480, 'nkapi_send', array( $id ) ); } And the following code is used to call schedule-event: schedule_event( $_SESSION['insert_id'] ); // …
I want testFunction() to call check() that i created in my plugin php when i click My Button. How do i make it work ? <?php function createButton() { echo '<button onclick="testFunction()">My Button</button>'; } function check() { alert("Works"); } function my_php_function() { echo '<script> function testFunction() { check(); } </script>'; } add_action( 'wp_footer', 'my_php_function' );
I am trying to develop a plugin, that shows on the page/post edit page. What I need to do, is detect when the content area changes. Either in visual mode, or text more. I would like to use a keyup event. So as the user is typing, I can provide my results. But with the tinymce editor, I can't seem to properly detect changes in the content area. I was at one point able to detect changes if the page …
This is kind of a stupid question... I scheduled a action to run every hour: if(!wp_next_scheduled('my_hourly_events')) wp_schedule_event(time(), 'hourly', 'my_hourly_events'); add_action('my_hourly_events', 'the_function_to_run'); function the_function_to_run(){ echo 'it works!'; } How can I test if this works without waiting an hour? :) I tried adding wp_clear_scheduled_hook('my_hourly_events'); before this code and adding wp_cron() after, but I don't see my function running... edit: ok, I added a trigger_error() inside my function, checked out the apache error log, and it's there :) So now I'm even …