Posted: June 30, 2013 at 12:17 pm
|
I created a page that list all events in a single category. However, the page only displays the first of the two prices (We have a price for non-member and member). I found this in the forum https://eventespresso.com/forums/2010/10/post-type-variables-and-shortcodes/ and see there is template code for event price. However, I am not sure which template file to add this to. Will adding this code indeed show both the Member and non-member price on all pages that list the events in a category? Thank you, |
|
Hi Carol, The old forum post you linked is from 2010, so its best to be careful with that information as sometime sits out of date. Here is the current shortcode information https://eventespresso.com/wiki/shortcodes-template-variables/#event-price It depends on how you have the prices set up. If you are using WP User Integraton (members) add on to create the member price, then unfortunately no it wont show those prices. If you have the price as just an alternative price then yes that shortcode will work. It can be added into the event_list_display.php template file. There are also these code options that show the prices in a range or list instead https://gist.github.com/sethshoultes/ab1e992668cf3166a686 Again, if you are using WP User Integration then they will show the logged in price or the logged out price. |
|
Thanks so much, Dean. I’m not a php person, so I have to ask, can the code be inserted anywhere in the template? It looks like this is the code snippet that I need, but I just get paranoid editing the php. π <?php do_action(‘action_hook_espresso_price_list’, $event_id);?> Thanks so much! |
Yes, you should be able to add that line of code in the event_list_display.php template file. As long as the section you are adding it to isn’t wrap in opening and closing () PHP tags. Does that make sense? |
|
|
I added this line of code immediately under the current price and it still isn’t showing the list. Here is the url of the page. http://nasw-wa.org/continuing-education/special-events/licensing-prep-courses/ Any other ideas? Thank you, |
Did you add the code, in the first code sample (event_espresso_price_list.php), into your theme’s functions.php file (wp-content/themes/theme-name/functions.php) or in the custom files addon (wp-content/uploads/espresso/custom_functions.php file)? |
|
|
Doh, I had not done that. But when I just added it, I got a parsing error at line 22. Here is the from line number 110 to 140 and the error said 122. <code>function no_generator() { return ''; } add_filter( 'the_generator', 'no_generator' ); function explain_less_login_issues(){ return '<strong>ERROR</strong>: Entered credentials are incorrect.';} add_filter( 'login_errors', 'explain_less_login_issues' ); /** Customize the entire footer */ remove_action( 'genesis_footer', 'genesis_do_footer' ); add_action( 'genesis_footer', 'custom_footer' ); function custom_footer() { ?> <p>&copy; Copyright 2013 | Website by: <a href="http://techtoolsonline.com/">Tech Tools, LLC</a> &middot; All Rights Reserved</p> <?php } <?php //This function should be added to the custom files addon, in the wp-content/uploads/espresso/custom_functions.php file, or your in your theme, in the wp-content/themes/theme-name/functions.php. if (!function_exists('event_espresso_price_list')) { function event_espresso_price_list($event_id) { $html = ''; global $wpdb, $org_options; $sql = "SELECT id, event_cost, surcharge, surcharge_type, price_type"; $order_by = 'event_cost'; if ( function_exists('espresso_members_installed') && espresso_members_installed() == true && is_user_logged_in() ) { $sql .= ", member_price, member_price_type "; $member_event = TRUE; $order_by = 'member_price'; } $sql .= " FROM " . EVENTS_PRICES_TABLE . " WHERE event_id='" . $event_id . "' ORDER BY " . $order_by . " ASC"; $results = $wpdb->get_results( $wpdb->prepare($sql, '') ); if ($wpdb->num_rows > 1) { //Create a dropdown of prices $html .= '<ul id="price-list-' . $event_id . '" class="espresso-price-list">';</code> |
You probably need to remove the opening and closing PHP tags from the code you posted. Eg. |
|
|
I am not getting the parsing error so that is good. However, it still isn’t inserting the list. I inserted the top code from https://gist.github.com/sethshoultes/ab1e992668cf3166a686 into functions.php. Then I entered the one line of code in the second window into the event_list_display.php file. In put it in right after the event price around line 72. Any other suggestions? Btw, thanks so much for hanging in there with me on this. |
The code in your event_espresso_price_list.php file may be a little different than mine, but you should probably add that one line of code within line 70, as seen in this screenshot: http://www.screencast.com/t/CXqjnbXZIEV If you just want to see how it looks, you should probably just add the code after line 73. Does that all make sense? |
|
|
Still nothing. π Here is a screenshot of my code. http://screencast.com/t/3EIkxRLw Line 70. π Here is my page view. http://screencast.com/t/pjF8kKbdN4 |
Did you move your template files to the /wp-content/uploads/espresso/templates? If so, please make sure you are making your edits in the /wp-content/uploads/espresso/templates/event_espresso_price_list.php file. If that is in fact the location that you are making your edits, and they are still not showing, then it may be a file permissions issue in that directory and the files contained within it. In that case you will need to make sure the file and directory permissions are set to 755. |
|
The support post ‘Page using shortcode of event categories only showing top price’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.