Home › Forums › Calendar Products › Events Calendar PRO › Formatting new Organizer List plugin
- This topic has 3 replies, 2 voices, and was last updated 11 years ago by
Geoff.
-
AuthorPosts
-
April 10, 2015 at 7:16 am #954575
Andrea Olson
ParticipantFirst, thanks so much for creating a plugin for adding a shortcode to create a list of organizers, directory-style, to the options (here: http://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/6240229-organizer-directory-list?tracking_code=16dfab85eb6b1366e78c207b20e13b7d). Makes things a ton easier!
However, I have no idea how to make my list come up alphabetically. Truthfully, I’d rather it come up sorted by REGION, but that is probably too complicated? Do you have a fix for the latter? Or, at the least, the former?
I am looking at editing this plugin file: venue-organizer-shortcode/venue-organizer-shortcode.php
The page where my directory current is: http://godiaperfree.com/go-diaper-free-certified-coach-directory/ – It’s kind of a mixed up list!
Please advise anything that can help. My goal is to have a list by region OR country, will settle for alphabetical, and I already have a map plugin working to help folks find an organizer by zip code/region here: http://godiaperfree.com/find-a-local-group/
And, lastly…if I can pay anyone to develop this for me, who would you recommend (if you can do so)? Btw, I would pay for an extension that allowed a custom directory to be made from an Organizer or Venue list, and I am probably not the only one. 🙂 There is little out there and I believe makes sense for most event listings to have such a directory. My two cents!
Thx! Andrea
April 10, 2015 at 8:49 am #954592Geoff
MemberHi Andrea, nice to see you again!
Good question, and an interesting one.
I do think that ordering the list would by Region would be quite a customization. We’d be happy to share a list of freelancers who might be able to help you out–if you’re interested, hit us up with an email to support [at] theeventscalendar.com and we’d be happy to send that along.
I was able to get the list to order alphabetically using this as the plugin. Give it a shot and let me know if this will work for you as well. 🙂
Cheers!
Geoffclass TEC_VenueOrganizer_List { protected $atts = array(); protected $query; protected $output = ''; public function __construct( $atts ) { $this->atts = shortcode_atts( array( 'post_type' => self::get_type( 'VENUE_POST_TYPE' ), 'limit' => -1, 'ordered' => 'title', 'ascending' => 'ASC' ), $atts ); } public function __toString() { $this->query(); $this->format(); return $this->output; } protected function query() { $args = array( 'post_type' => $this->atts['post_type'], 'posts_per_page' => $this->atts['limit'], 'orderby' => $this->atts['ordered'], 'order' => $this->atts['ascending'] ); $this->query = new WP_Query( apply_filters( __CLASS__ . '.args', $args, $this->atts ) ); } protected function format() { $opening_tag = '<ul class="tec list ' . $this->atts['post_type'] . '">'; $this->output = apply_filters( __CLASS__ . '.list.open', $opening_tag, $this->atts ); while ( $this->query->have_posts() ) { $this->query->the_post(); $link = '<a href="' . get_the_permalink() . '">' . get_the_title() . '</a>'; $item = '<li class="tec list ' . $this->atts['post_type'] . '">' . $link . '</li>'; $this->output .= apply_filters( __CLASS__ . '.list.item', $item, $this->atts ); } $this->output .= apply_filters( __CLASS__ . '.list.close', '</ul>', $this->atts ); wp_reset_postdata(); } public static function get_type( $type_const ) { if ( class_exists( 'Tribe__Events__Events' ) ) $class = 'Tribe__Events__Events'; elseif ( class_exists( 'TribeEvents' ) ) $class = 'TribeEvents'; else return false; $class = new ReflectionClass( $class ); return $class->getConstant( $type_const ); } } function tec_do_venue_shortcode( $atts ) { $type = TEC_VenueOrganizer_List::get_type( 'VENUE_POST_TYPE' ); if ( ! $type ) return ''; $atts['post_type'] = $type; return new TEC_VenueOrganizer_List( $atts ); } function tec_do_organizer_shortcode( $atts ) { $type = TEC_VenueOrganizer_List::get_type( 'ORGANIZER_POST_TYPE' ); if ( ! $type ) return ''; $atts['post_type'] = $type; return new TEC_VenueOrganizer_List( $atts ); } add_shortcode( 'list_venues', 'tec_do_venue_shortcode' ); add_shortcode( 'list_organizers', 'tec_do_organizer_shortcode' );April 15, 2015 at 8:48 am #955744Andrea Olson
ParticipantThis will resolve it for now! I will email you guys for a list of freelancers who can help with the rest, but for now, your code revision works to alphabetize my list, and I am grateful for that!! Thanks Geoff!
Andrea
April 17, 2015 at 9:15 am #956305Geoff
MemberMy pleasure, Andrea! I’m so glad this helped out for the time being. 🙂
I’ll go ahead and close this thread, but do please feel free to hit us up with a new thread if anything else pops up–we’d be happy to help.
Cheers!
Geoff -
AuthorPosts
- The topic ‘Formatting new Organizer List plugin’ is closed to new replies.
