Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Forum: Plugins
    In reply to: [Zotpress] Auto-Import/Sync

    +1 for auto-syncing. I’m sure we should be able to do it with the cron…

    Hi Katie,

    Thanks for your response. I see it now! Before, when I wanted to insert the bibliography, I clicked on the “bibliography” tab in the post compose window. I didn’t think that it would be below the shortcode for an in-text citation.

    What remains unclear to me, then, is what the search box does in the bibliography tab. No matter what I search for there, I seem unable to influence the shortcode that is generated…

    I totally didn’t see this either, and can’t figure how to generate the shortcode using the “Zotpress Reference” widget in the post composer screen.

    Thread Starter Bucketsaway

    (@bucketsaway)

    I should note that, in my last post, I changed the shortcode from event-sponsor to just sponsor. So the shortcode would like like this: [events_list limit="10" sponsor="ohst"]#_EVENTNAME <br/>[/events_list]

    Hope someone else finds this useful.

    Thread Starter Bucketsaway

    (@bucketsaway)

    Ok, I finally figured it out, and went one better to be able to use the slug in the shortcode instead of the term taxonomy ID. Here’s my solution, which means I can use shortcode like the one I used in my first post. Thanks for your help!

    // This is a way to load event sponsors by slug rather than term taxonomy ID, making it easier to shortcode
    function my_em_sponsors_event_load($EM_Event){
    	global $wpdb;
    	$tax_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id='{$EM_Event->post_id}'", 0	);
    	$term_slugs = array();
    	foreach($tax_ids as $tax_id){
    		$term_ids = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id=$tax_id", 0	);
    		foreach($term_ids as $term_id){
    			$term_slug = $wpdb->get_col("SELECT slug FROM $wpdb->terms WHERE term_id=$term_id", 0	);
    			$term_slugs[] = implode( $term_slug);
    		}
    
    	}
    	$EM_Event->sponsors = $term_slugs;
    	//$EM_Event->sponsors = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id='{$EM_Event->post_id}'", 0	); //Use this if you just want to use the term taxonomy ID in the shortcode
    }
    add_action('em_event','my_em_sponsors_event_load',1,1);
    
    // And make the search attributes for the shortcode
    add_filter('em_events_get_default_search','my_em_sponsors_get_default_search',1,2);
    function my_em_sponsors_get_default_search($searches, $array){
    	if( !empty($array['sponsor']) ){
    		$searches['sponsor'] = $array['sponsor'];
    	}
    	return $searches;
    }
    
    add_filter('em_events_get','my_em_sponsors_events_get',1,2);
    function my_em_sponsors_events_get($events, $args){
    	if( !empty($args['sponsor'])  ){
    		foreach($events as $event_key => $EM_Event){
    			if( !in_array($args['sponsor'],$EM_Event->sponsors) ){
    				unset($events[$event_key]);
    			}
    		}
    	}
    	//print_r($events); // Use this for debugging
    	return $events;
    }
    Thread Starter Bucketsaway

    (@bucketsaway)

    This problem really is driving me crazy. I’ve also included the following code in my functions.php

    function my_em_sponsors_event_load($EM_Event){
    	global $wpdb;
    	$EM_Event->event_sponsor = $wpdb->get_col("SELECT meta_value FROM ".EM_META_TABLE." WHERE object_id='{$EM_Event->event_id}' AND meta_key='event-sponsor'", 0	);
    }
    add_action('em_event','my_em_sponsors_event_load',1,1);

    But that doesn’t seem to help, as it wants to look in the em_meta table instead of the standard taxonomies. So I changed it to this:

    function my_em_sponsors_event_load($EM_Event){
    	global $wpdb;
    	$EM_Event->event_sponsor = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id='{$EM_Event->event_id}'", 0	);
    }
    add_action('em_event','my_em_sponsors_event_load',1,1);

    This means that I need to use the term taxonomy ID instead of the term ID, which I found in the term_taxonomy table in my database.

    I know I’m missing something simple here, but my coding just isn’t up to scratch to catch it. Anyone? Thanks.

    Thread Starter Bucketsaway

    (@bucketsaway)

    another update: I’ve also tried using the taxonomy IDs instead of the slugs, and here’s what happens:

    • When I used the slug, it would show me all events, not filtering them at all
    • When I use an ID of a taxonomy, no matter which taxonomy (I went through them all), I don’t get any events to show
    • When I use a range of taxonomy IDs (e.g. “1,2,3”), all events show, including ones not listed with any of those IDs.

    Any thoughts are most welcome!

    Thread Starter Bucketsaway

    (@bucketsaway)

    Ok, a little update here: I followed the instructions in Step 6 of the add-on tutorial, adding the following code to my functions.php in my template folder:

    add_filter('em_events_get_default_search','my_em_event_sponsors_get_default_search',1,2);
    function my_em_event_sponsors_get_default_search($searches, $array){
    	if( !empty($array['event_sponsor']) && is_numeric($array['event_sponsor']) ){
    		$searches['event_sponsor'] = $array['event_sponsor'];
    	}
    	return $searches;
    }
    
    add_filter('em_events_get','my_em_event_sponsors_events_get',1,2);
    function my_em_event_sponsors_events_get($events, $args){
    	if( !empty($args['event_sponsor']) && is_numeric($args['event_sponsor']) ){
    		foreach($events as $event_key => $EM_Event){
    			if( !in_array($args['event_sponsor'],$EM_Event->event_sponsor) ){
    				unset($events[$event_key]);
    			}
    		}
    	}
    	return $events;
    }

    I still do not get any results from the shortcode in my last post, though.

    Thread Starter Bucketsaway

    (@bucketsaway)

    For anyone also hoping to do something like this, here’s what I did:

    • I created locations for each place my event was held at
    • I did not fill out the location section for the event
    • I included links to the locations in the body of the event text

    For those of you who don’t know, you can remove the location text (And whatever surrounding text you want) in your templates where no location is specified by using the following code:
    {no_location}whatever text/html/shortcodes you want{/no_location}
    It took me a long time to figure that out! Other useful conditionals are here:
    https://wp-events-plugin.com/documentation/conditional-placeholders/

    Bucketsaway

    (@bucketsaway)

    Hi all,

    I’m discovering this same issue with my blog right now with the upcoming DST change. I have the latest events plugin, and the latest wordpress, and my host is dreamhost.

    Marcus, did you encounter any solution while working on your other problem?

    Thanks!

    akiraprise, did you get it to work?

    in this example, the “styles” attribute should be a dropdown list. For instance:

    #_ATT{styles}{red|blue|green|brown}

    The conditional then takes the form

    {is_styles_red}This would be test that would appear if the style was red{/is_styles_red}
    {is_styles_blue}This would be test that would appear if the style was blue{/is_styles_blue}

    with some modification of the code, you could get it to work for a text field instead of a dropdown list, but I haven’t tried that.

    ok, I got it to work! The main problem was relating the event_id to the post_id, as the Event Attributes are stored in postmeta, while the hook you need to use relies on $EM_Event. I’m not sure I understand fully why this works, but it seems to. Marcus, might you consider including this in your documentation (and maybe cleaning it up a little)?

    I have used “styles” as the name of the attribute, to stay in line with Marcus’ tutorial.

    I hope this helps, akiraprise.

    add_action('em_event_output_condition', 'my_em_styles_event_output_condition', 1, 4);
    function my_em_styles_event_output_condition($replacement, $condition, $match, $EM_Event){
    	global $wpdb;
    	$postid = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_value = '{$EM_Event->event_id}' AND meta_key='_event_id'", 0	);
    	$styles_check = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.post_id = $postid[0] AND meta_key='styles'", 0	);
    	if( is_object($EM_Event) && preg_match('/^is_styles_(.+)$/',$condition, $matches) ){
    		if( in_array($matches[1],$styles_check) ){
    			$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
    		}else{
    			$replacement = '';
    		}
    	}
    	return $replacement;
    }

    I’m working through the same problem. I don’t want to create a whole new addon just to add a quick attribute.

    I don’t think it is unique to akiraprise’s problem (though, of course, Marcus is the one who would know best). The way I see it, the basic issue is: can we create conditional placeholders for Event Attributes, or can we only do it for custom placeholders? If the former, what’s the main difference?

    Thanks.

    I’m having a similar problem using plugin version 0.8.1 and wordpress 3.2.1. I modified customsidebars.php as you suggested (the code apparently still hasn’t been updated), but in addition, whenever I put ANYTHING in the “Before title”, “After title”, “Before widget”, or “After widget” areas, it breaks the sidebar completely. Without anything there, it works fine. But I need to style different sidebars with different div classes…

    Unfortunately, I’m using a graphpaperpress theme, which is a premium theme, so I know your assistance can only be limited. But if you have any thoughts on what might be causing the problem, I’m be delighted to hear them!

    Thanks.

Viewing 15 replies - 1 through 15 (of 16 total)