function amr_format_taxonomy_link($tax_name, $tax_term, $link = '') { // will receive id // if in widget should link to calendar page // if in agenda or calendar - same ? // if in event info - either calendar page or archive global $amr_calendar_url, $amr_taxonomy_url; if (empty($amr_taxonomy_url)) { // not yet set if (empty($amr_calendar_url)) { $amr_taxonomy_url = amr_clean_link(); // not good - basically populates the global when it possible should not } else { $amr_taxonomy_url = $amr_calendar_url; } } if (empty($link) and !empty($amr_taxonomy_url)) { $link = $amr_taxonomy_url; } $term = get_term($tax_term, $tax_name, OBJECT); //var_dump($term); if (!isset($term->name)) { // if it is not a wordpress taxonomy ? $name = $tax_term; $link2 = add_query_arg('category', $tax_term, $link); $title = sprintf(__('View events in %s %s', 'amr-ical-events-list'), __('category'), $tax_term); } else { $name = $term->name; $link2 = add_query_arg($tax_name, $term->slug, $link); $title = sprintf(__('View events in %s %s', 'amr-ical-events-list'), __($tax_name, 'amr-ical-events-list'), $term->name); } $html = '<a href="' . htmlspecialchars($link2) . '" title="' . $title . '">' . $name . '</a>'; return $html; }
function amr_get_day_link_stem() { global $amr_calendar_url, $amr_limits; if (!empty($amr_calendar_url)) { // if they have defined a url to use for these sorts of links, then use it $link = $amr_calendar_url; } else { // else get a clean version of the current url $link = amr_clean_link(); } // how do we know whether to force a listtype or not ? // we must if in large calendar or small calendar // and it should be the agenda one // If they have specified a url, then that page should either already be // in a suitable listtype, or the url should have a listtype passed to it. if (!empty($amr_limits['agenda'])) { // do not want listtype unless requested? $agenda = $amr_limits['agenda']; } else { $agenda = 1; } $link = add_query_arg('listtype', $agenda, $link); return $link; }