/**
 * Basic breadcrumbs for custom post type Pod, using load_pod to get Pod labels.
 *
 * Someone should add handling for posts and pages as well as ACTs to this. Possibly make a plugin.
 */
function slug_post_type_breadcrumb($divider = '>>')
{
    $front = slug_link(site_url(), 'Home');
    if (is_home() || is_front_page()) {
        return $front;
    }
    if (is_post_type_archive() || is_singular() && get_post_type() !== false) {
        $post_type = get_post_type();
        $pod = pods_api()->load_pod($post_type);
        if (!is_string($pod)) {
            $single = $pod->options['single_label'];
            $plural = slug_link(get_post_type_archive($post_type), $pod->label, 'All ' . $single);
            if (is_post_type_archive()) {
                return $front . $divider . $plural;
            }
            global $post;
            $single = slug_link(get_permalink($post->ID), get_the__title($post->ID), 'View ' . $single);
            return $front . $divider . $single;
        } else {
            return;
        }
    }
}
示例#2
0
 function em_get_search_form($echo = true, $args = array())
 {
     // get events page link
     if (($page_id = em_get_page_id('events')) != 0) {
         $link = get_permalink($page_id);
     } else {
         $link = get_post_type_archive('event');
     }
     $defaults = array('title' => __('Events Search', 'events-maker'), 'link' => esc_url($link), 'show_string_input' => true, 'string_input_placeholder' => __('Enter event name...', 'events-maker'), 'show_date_input' => true, 'start_date_placeholder' => __('Select start date...', 'events-maker'), 'end_date_placeholder' => __('Select end date...', 'events-maker'), 'show_event_categories' => true, 'show_event_locations' => true, 'show_event_organizers' => true, 'show_event_tags' => true);
     $args = apply_filters('em_get_search_form_args', wp_parse_args($args, $defaults));
     ob_start();
     em_get_template('searchform-event.php', $args);
     $html = ob_get_contents();
     ob_end_clean();
     if ($echo === true) {
         echo $html;
     } else {
         return $html;
     }
 }