Example #1
0
 /**
  * Add anspress classess to body
  * @param  array $classes Body class attribute.
  * @return array
  * @since 2.0.1
  */
 public function body_class($classes)
 {
     // Add anspress class to body.
     if (is_anspress()) {
         $classes[] = 'anspress';
         $classes[] = 'ap-page-' . ap_current_page();
     }
     return $classes;
 }
Example #2
0
/**
 * Check if current page is user page
 * @return boolean
 */
function is_ap_user()
{
    if (is_anspress() && ap_current_page() == ap_get_user_page_slug()) {
        return true;
    }
    return false;
}
Example #3
0
/**
 * Get breadcrumbs array
 * @return array
 */
function ap_get_breadcrumbs()
{
    $current_page = ap_current_page();
    $title = ap_page_title();
    $a = array();
    $a['base'] = array('title' => ap_opt('base_page_title'), 'link' => ap_base_page_link(), 'order' => 0);
    if (is_question_tag()) {
        $a['tag'] = array('title' => __('Tags', 'ap'), 'link' => '', 'order' => 10);
    } elseif (is_question()) {
        $a['page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => get_permalink(get_question_id()), 'order' => 10);
    } elseif ('base' != $current_page && '' != $current_page) {
        if ('user' == $current_page) {
            $a['page'] = array('title' => __('User', 'ap'), 'link' => ap_user_link(ap_get_displayed_user_id()), 'order' => 10);
            $a['user_page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => ap_user_link(ap_get_displayed_user_id(), get_query_var('user_page')), 'order' => 10);
        } else {
            $a['page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => ap_get_link_to($current_page), 'order' => 10);
        }
    }
    $a = apply_filters('ap_breadcrumbs', $a);
    return ap_sort_array_by_order($a);
}