AJD
Forum Replies Created
-
Adding scope has helped, but there are still ‘no location’ pins.
For example:
[locations_map scope=”future” limit=”100″ country=”GB,IE,NL” width=”100%” height=”600px”]
https://aametinternational.org/eft-training-courses-united-kingdom/
Okay, I figured out that I can use: #_LOCATIONNEXTEVENT , and then format the date with the settings in Locations > Event List Formats.
It would be nice if regular event placeholders would work though.
Yes they have the correct status in admin.
Thanks, I’m pretty sure that is the problem. Can you add a little more detail? em_event_set_status filter is attached to the set_status() function. Does that function fire whenever the post status is updated?
Here’s the update status function I’m using:
//We need to hide events that were published by expired users add_action( 'set_user_role', 'draft_demoted_user_events', 10, 2 ); function draft_demoted_user_events( $demoted_author_id, $role ) { if( ('subscriber' == $role) || ('s2member_level0' == $role) && 'publish' == get_post_status( $p->ID) ) { $args = array( 'numberposts' => -1, 'author' => $demoted_author_id, 'post_type' => 'event', ); $demoted_author_posts = get_posts( $args ); foreach( $demoted_author_posts as $p ) { $my_post = array( 'ID' => $p->ID, 'post_status' => 'pending', ); wp_update_post( $my_post ); //Now do Events Manager Status Stuff: set_status(); } } }- This reply was modified 9 years, 8 months ago by AJD. Reason: clarity
I have tried using the em_content filter for this, however so far I can only get it to add content before or after the events list, but not replace or hide events in the list.
Forum: Plugins
In reply to: [Advanced Custom Fields: Image Crop Add-on] Not working for non-adminsI’m encountering this same problem. When a non-admin clicks the ‘add image’ button, nothing happens.
capability did not help.
I did get it to work with the linked solution:
By adding thisfunction load_wp_media_files() { // add a specific condition to select the pages the media uploader must appear wp_enqueue_media(); } add_action( 'wp_enqueue_scripts', 'load_wp_media_files' );AND adding upload_files capability, however the user can now see all images in the media library, not only the ones uploaded to the post.
Update:
After looking through the code it appears that there is no template for the this particular page and instead it is dynamically created with the em_events_admin() function that is defined in em-template-tags.php.What I have done is to create a custom page template and called the em_events_admin() function in it, and it seems to work fine… except I need to customize the $args for the function.
So… I’ll post a new question about that.
I think it must have something to do with the particular install, because it worked on a new WordPress install. Marking resolved.
Forum: Themes and Templates
In reply to: wp_dropdown_categories with custom taxo goes to 404Sadly wp_dropdown_catetories seems broken when it comes to permalinks.
I am using a different method from here.
Forum: Themes and Templates
In reply to: wp_dropdown_categories with custom taxo goes to 404Sadly wp_dropdown_categories seems broken when it comes to the permalinks.
I’m using this working version from here.
<form action="<?php bloginfo('url'); ?>/" method="get"> <?php $term_id = 279; $taxonomy_name = 'categories'; $termchildren = get_term_children( $term_id, $taxonomy_name ); $children = array(); foreach ($termchildren as $child) { $term = get_term_by( 'id', $child, $taxonomy_name ); $children[$term->name] = $term; } ksort($children); echo '<select name="' . $taxonomy_name . '" onchange="this.form.submit()">'; echo '<option selected>Branding...</option>'; foreach ( $children as $child ) { $term = get_term_by( 'id', $child->term_id, $taxonomy_name ); echo '<option value="'. $term->slug .'">' . $term->name . '</a></option>'; } echo '</select>'; ?> <noscript><div><input type="submit" value="View" /></div></noscript> </form>Forum: Plugins
In reply to: [WooCommerce] Redirect category if it only has a single productHi,
There was no error and even without the extra; it just didn’t do anything.I came up with a different solution because I also wanted to redirect any tag archive pages that only have one product:
Here’s the working code:
/* Redirect if there is only one product in the category or tag, or anywhere... */ function redirect_to_single_post(){ global $wp_query; if( is_archive() && $wp_query->post_count == 1 ){ the_post(); $post_url = get_permalink(); wp_safe_redirect($post_url , 302 ); exit; } } add_action('template_redirect', 'redirect_to_single_post');Forum: Plugins
In reply to: [WooCommerce] Redirect to single product in subcategoryThis following code is working for me, but I wanted to redirect anytime there is a single item on an archive page. Tags and Categories:
/* Redirect if there is only one product in the category or tag, or anywhere... */ function redirect_to_single_post(){ global $wp_query; if( is_archive() && $wp_query->post_count == 1 ){ the_post(); $post_url = get_permalink(); wp_safe_redirect($post_url , 302 ); exit; } } add_action('template_redirect', 'redirect_to_single_post');Forum: Plugins
In reply to: [WooCommerce] Redirect category if it only has a single productI tried reworking the code modeled after the single search result snippet you have above and hooked to template_redirect, but it doesn’t work:
/* Redirect if there is only one product in the category */ add_action( 'template_redirect', 'woocom_redirect_if_single_product_in_category', 10 ); function woocom_redirect_if_single_product_in_category() { global $wp_query, $wp;; if ( is_post_type_archive( 'product' ) && 1 === $wp_query->found_posts ) { $product = wc_get_product($wp_query->post->ID); if ( $product && $product->is_visible() ) { wp_safe_redirect( get_permalink( $product->id ), 302 ); exit; } } }Forum: Plugins
In reply to: Redirect to product page if only one product in categoryYou may want to look over here:
https://wordpress.org/support/topic/redirect-category-if-it-only-has-a-single-product
Forum: Plugins
In reply to: [WooCommerce] Redirect category if it only has a single productI’d like to do the same, it doesn’t work on ‘init’, ‘wp_loaded’ or ‘after_setup_theme’