Events Made Easy › Forums › How do I … › how to convert my widget code to work with events manger
- This topic has 7 replies, 2 voices, and was last updated 14 years, 4 months ago by Franky.
-
AuthorPosts
-
Fri 13 Aug 2010 at 08:45 #42007AnonymousInactive
Here is the relevent snippet of code that I currently use for displaying custom post-type ‘events’ in my widget sidebar. I’ve tried to understand the events manager code base, but just plain don’t get it. Hoping you could lend a hand.
<?
// Place this function into your functions.php
function generate_week_events($id, $date) {
global $post;
?>
<div id="tabs-<? echo $id; ?>">
<?
// This pulls all the posts in the events category that have a meta value that equals the date being fed into this function
$args=array('cat'=> 9, 'meta_value'=> $date);
query_posts($args);
//This is ancillary to the function. only if you want the date: January 1st, 2010 in the description
//$r_date = explode('/', $date);
//$mk_date = mktime( 0,0,0, date($r_date[0]), date($r_date[1]), date($r_date[2]));
// $print_date = date('F jS Y', $mk_date);
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div>
<strong><a href="<? the_permalink(); ?>"><? the_title(); ?></a></strong><br>
<?
$location = get_post_meta($post->ID, 'event location', true);
if ($location!='') {
echo "@" . $location;
}
?>
</div>
<? endwhile; else: endif; ?>
<? wp_reset_query(); ?>
</div>
<?
}
?>The rest of the code is just my output, so it’s not really relevent. I can provide the entire code if needed, but prefer keeping it private for now.
Fri 13 Aug 2010 at 09:33 #44286FrankyKeymasterErrr … what do you want to accomplish? From this code I can’t really deduce anything. You can always pm me if you want to take this private: liedekef [at] telenet.be
Fri 13 Aug 2010 at 09:40 #44287FrankyKeymasterErrr … what do you want to accomplish? From this code I can’t really deduce anything. You can always pm me if you want to take this private: liedekef [at] telenet.be
Fri 13 Aug 2010 at 09:51 #44288AnonymousInactiveemail sent.
Basically I have a system ‘not events manager’ where I save my events in category 9. I have a custom field ‘event location’ as well.
I’m simply looping through the posts in category 9, and separating them out to display according to their date.
The rest of the code I emailed you will make everything much more clear.
Basically I am simply trying to adapt this widget code that I use for use with events manager.
I could find no documentation of how to use functions to manually call the events posts. I could only find the shortcodes, which does not help me out. I much prefer working with the actual functions.
Fri 13 Aug 2010 at 11:06 #44289FrankyKeymasterI haven’t read the mail yet but if you want to use the functions: http://www.e-dynamics.be/wordpress/#displaying-events-and-locations (the template tags are in fact functions)
Sat 14 Aug 2010 at 05:45 #44290AnonymousInactiveThank you for the functions reference page. I am quite used to working with the functions, but really have no clue how I am going to use my custom widget code with those functions. For the most part, I am just used to using custom wp_queries so this is rather new to me.
I do love the events manager plugin though. It’s one of the only plugins that I install on almost every site I build. Glad to see someone taking over the plugin and making it better.
Tue 17 Aug 2010 at 12:03 #44291AnonymousInactiveI know it’s only been 3 days, but by any chance did you have a chance to look at my email code?
I’ve been going through the events manager code as best I can, but cannot figure out how to merge the concepts together.
Tue 17 Aug 2010 at 13:36 #44292FrankyKeymasterWell, for the moment I’m spending my time upgrading the google maps API used to version 3, but I’m fighting with some IE8 layout issues for the bubbles shown. If you’re interested: http://www.e-dynamics.be/wordpress/?p=54
After that, you’re up 🙂
-
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.