How to detect and handle the time difference between server and user in WordPress?
How to detect and handle the time difference between server and user in WordPress?
How to detect and handle the time difference between server and user in WordPress?
I handle this with AJAX. Bellow is the solution. HTML: <label><?php _e( ‘Featured Image’, EG360_TEXT_DOMAIN ); ?></label> <div id=”eg360_tax_image” style=”float: left; margin-right: 10px;”> <img src=”<?php echo esc_url( eg360_placeholder_image() ); ?>” width=”60px” height=”60px”/> </div> <div style=”line-height: 60px;”> <input type=”hidden” id=”eg360_tax_image_id” name=”eg360_tax_image_id”/> <button type=”button” class=”upload_image_button button”><?php _e( ‘Upload/Add image’, EG360_TEXT_DOMAIN ); ?></button> <button type=”button” class=”remove_image_button button”><?php _e( … Read more
So i finally figured it out, the gallery switches modes sometimes, even without clicking anything (not completely sure what actually happens, I have no idea about Backbone tbh.) Here is what now works for me: if(wp.media.frame.content.get(‘gallery’).collection) { wp.media.frame.content.get(‘gallery’).collection.add(formatted); } else { wp.media.frame.controller.content.get(‘gallery’).collection.add(formatted); } The else-line won’t work when initially loading of media library, so I … Read more
How to show only the last two categories in a menu?
Pass custom props to
Are you maybe looking for something like this? /** * Outputs blog / archive pagination * */ function my_pagination(){ global $wp_query; $total_pages = $wp_query->max_num_pages; if ($total_pages > 1): $current_page = max(1, get_query_var(‘paged’)); echo paginate_links(array( ‘current’ => $current_page, ‘total’ => $total_pages, ‘prev_text’ => ‘Prev’, ‘next_text’ => ‘Next’, ‘type’ => ‘list’ )); endif; } Then include it … Read more
Check if theme supports sidebar
I tried…but ended up going a completely different direction, as there appears to be no viable solution. I ended Storing in a temporary database entry. Does potentially have race conditions, if two people are using the same account. But for those who are interested, here was my solution: I am using the very effective plugin … Read more
Attaching Image-file to userId
There’s no sense in using the init hook because this hook will be triggered on each page load. If you want to update pages’ status every time when someone updates a field, you can use any of the following hooks: acf/update_field – this filter hook fires every time when a field is updated before it … Read more