示例#1
0
/**
 * Makes sure we're in "THE Loop", which is determinied by a flag set when the_post() (start) is first called, and when have_posts() (end) returns false.
 * @param string $data
 * @return string
 */
function em_wp_the_title($data, $id = null)
{
    global $post, $wp_query, $EM_Location, $EM_Event;
    if (empty($post)) {
        return $data;
    }
    //fix for any other plugins calling the_content outside the loop
    //because we're only editing the main title of the page here, we make sure we're in the main query
    if (is_main_query()) {
        $events_page_id = get_option('dbem_events_page');
        $locations_page_id = get_option('dbem_locations_page');
        $edit_events_page_id = get_option('dbem_edit_events_page');
        $edit_locations_page_id = get_option('dbem_edit_locations_page');
        $edit_bookings_page_id = get_option('dbem_edit_bookings_page');
        if (is_main_query() && !empty($post->ID) && in_array($post->ID, array($events_page_id, $locations_page_id, $edit_events_page_id, $edit_locations_page_id, $edit_bookings_page_id))) {
            if ($wp_query->in_the_loop) {
                return apply_filters('em_wp_the_title', em_content_page_title($data, $id));
            }
        } elseif (is_main_query() && is_single() && !empty($post->post_type)) {
            if ($post->post_type == EM_POST_TYPE_EVENT) {
                $EM_Event = em_get_event($post);
                return apply_filters('em_wp_the_title', $EM_Event->output($data));
            } elseif ($post->post_type == EM_POST_TYPE_LOCATION) {
                $EM_Location = em_get_location($post);
                return apply_filters('em_wp_the_title', $EM_Location->output($data));
            }
        }
    }
    return $data;
}
示例#2
0
/**
 * Makes sure we're in "THE Loop", which is determinied by a flag set when the_post() (start) is first called, and when have_posts() (end) returns false.
 * @param string $data
 * @return string
 */
function em_wp_the_title($data)
{
    //This is set by the loop_start and loop_end actions
    global $post;
    global $wp_query;
    if (get_option('dbem_disable_title_rewrites') != 1 && !empty($post->ID) && get_option('dbem_events_page') == $post->ID) {
        if ($wp_query->in_the_loop) {
            return apply_filters('em_wp_the_title', em_content_page_title($data));
        }
    }
    return $data;
}
/**
 * Makes sure we're in "THE Loop", which is determinied by a flag set when the_post() (start) is first called, and when have_posts() (end) returns false.
 * @param string $data
 * @return string
 */
function em_wp_the_title($data, $id = null)
{
    global $post, $wp_query, $EM_Location;
    if (empty($post)) {
        return $data;
    }
    //fix for any other plugins calling the_content outside the loop
    //because we're only editing the main title of the page here, we make sure we're in the main query
    if (is_main_query()) {
        $events_page_id = get_option('dbem_events_page');
        $locations_page_id = get_option('dbem_locations_page');
        $edit_events_page_id = get_option('dbem_edit_events_page');
        $edit_locations_page_id = get_option('dbem_edit_locations_page');
        $edit_bookings_page_id = get_option('dbem_edit_bookings_page');
        if (is_main_query() && !empty($post->ID) && in_array($post->ID, array($events_page_id, $locations_page_id, $edit_events_page_id, $edit_locations_page_id, $edit_bookings_page_id))) {
            if ($wp_query->in_the_loop) {
                return apply_filters('em_wp_the_title', em_content_page_title($data, $id));
            }
        }
    }
    return $data;
}
示例#4
0
/**
 * Makes sure we're in "THE Loop", which is determinied by a flag set when the_post() (start) is first called, and when have_posts() (end) returns false.
 * @param string $data
 * @return string
 */
function em_wp_the_title($data)
{
    //This is set by the loop_start and loop_end actions
    global $post, $wp_query, $EM_Location;
    $events_page_id = get_option('dbem_events_page');
    $locations_page_id = get_option('dbem_locations_page');
    $edit_events_page_id = get_option('dbem_edit_events_page');
    $edit_locations_page_id = get_option('dbem_edit_locations_page');
    $edit_bookings_page_id = get_option('dbem_edit_bookings_page');
    if (!is_main_query() && !empty($post->ID) && in_array($post->ID, array($events_page_id, $locations_page_id, $edit_events_page_id, $edit_locations_page_id, $edit_bookings_page_id))) {
        if ($wp_query->in_the_loop) {
            return apply_filters('em_wp_the_title', em_content_page_title($data));
        }
    }
    return $data;
}