当前位置: 首页>>代码示例>>PHP>>正文


PHP ap_base_page_link函数代码示例

本文整理汇总了PHP中ap_base_page_link函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_base_page_link函数的具体用法?PHP ap_base_page_link怎么用?PHP ap_base_page_link使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ap_base_page_link函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ap_get_breadcrumbs

function ap_get_breadcrumbs()
{
    $current_page = get_query_var('ap_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 ($current_page != 'base' && $current_page != '') {
        if ($current_page == 'user') {
            $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);
}
开发者ID:haythameyd,项目名称:powrly,代码行数:21,代码来源:theme.php

示例2: permanent_delete_post

 /**
  * Handle Ajax callback for permanent delete of post.
  */
 public function permanent_delete_post()
 {
     $post_id = (int) $_POST['post_id'];
     $action = 'delete_post_' . $post_id;
     if (!ap_verify_nonce($action) || !ap_user_can_permanent_delete()) {
         $this->something_wrong();
     }
     $post = get_post($post_id);
     wp_trash_post($post_id);
     if ($post->post_type == 'question') {
         do_action('ap_wp_trash_question', $post_id);
     } else {
         do_action('ap_wp_trash_answer', $post_id);
     }
     wp_delete_post($post_id, true);
     if ($post->post_type == 'question') {
         $this->send(array('action' => 'delete_question', 'do' => array('redirect' => ap_base_page_link()), 'message' => 'question_deleted_permanently'));
     } else {
         $current_ans = ap_count_published_answers($post->post_parent);
         $count_label = sprintf(_n('1 Answer', '%d Answers', $current_ans, 'anspress-question-answer'), $current_ans);
         $remove = !$current_ans ? true : false;
         $this->send(array('action' => 'delete_answer', 'div_id' => '#answer_' . $post_id, 'count' => $current_ans, 'count_label' => $count_label, 'remove' => $remove, 'message' => 'answer_deleted_permanently', 'view' => array('answer_count' => $current_ans, 'answer_count_label' => $count_label)));
     }
 }
开发者ID:alaershov,项目名称:anspress,代码行数:27,代码来源:ajax.php

示例3: ap_post_edit_link

/**
 * Return edit link for question and answer.
 *
 * @param int| object $post_id_or_object
 *
 * @return string
 *
 * @since 2.0.1
 */
function ap_post_edit_link($post_id_or_object)
{
    if (!is_object($post_id_or_object)) {
        $post_id_or_object = get_post($post_id_or_object);
    }
    $post = $post_id_or_object;
    $nonce = wp_create_nonce('nonce_edit_post_' . $post->ID);
    $edit_link = add_query_arg(array('ap_page' => 'edit', 'edit_post_id' => $post->ID, '__nonce' => $nonce), ap_base_page_link());
    return apply_filters('ap_post_edit_link', $edit_link);
}
开发者ID:Krl4,项目名称:anspress,代码行数:19,代码来源:functions.php

示例4: post_type_link

 /**
  * Alter question and answer CPT permalink
  * @param  string $link
  * @param  object $post 
  * @return string
  * @since 2.0.0-alpha2
  */
 public function post_type_link($link, $post)
 {
     if ($post->post_type == 'question') {
         $question_slug = ap_opt('question_page_slug');
         if (get_option('permalink_structure')) {
             if (ap_opt('question_permalink_follow')) {
                 return rtrim(ap_base_page_link(), '/') . '/' . $question_slug . '/' . $post->post_name . '/';
             } else {
                 return home_url('/' . $question_slug . '/' . $post->post_name . '/');
             }
         } else {
             return add_query_arg(array('apq' => false, 'question_id' => $post->ID), ap_base_page_link());
         }
     } elseif ($post->post_type == 'answer' && $post->post_parent != 0) {
         return get_permalink($post->post_parent) . "?show_answer={$post->ID}#answer_{$post->ID}";
     }
     return $link;
 }
开发者ID:haythameyd,项目名称:powrly,代码行数:25,代码来源:post_types.php

示例5: post_type_link

 /**
  * Alter question and answer CPT permalink
  * @param  string $link
  * @param  object $post
  * @return string
  * @since 2.0.0-alpha2
  */
 public function post_type_link($link, $post)
 {
     if ($post->post_type == 'question') {
         $question_slug = ap_opt('question_page_slug');
         if (empty($question_slug)) {
             $question_slug = 'question';
         }
         if (get_option('permalink_structure')) {
             if (ap_opt('question_permalink_follow')) {
                 $link = rtrim(ap_base_page_link(), '/') . '/' . $question_slug . '/' . $post->post_name . '/';
             } else {
                 $link = home_url('/' . $question_slug . '/' . $post->post_name . '/');
             }
         } else {
             $link = add_query_arg(array('apq' => false, 'question_id' => $post->ID), ap_base_page_link());
         }
         /**
          * FILTER: ap_question_post_type_link
          * Allow overriding of question post type permalink
          */
         return apply_filters('ap_question_post_type_link', $link, $post);
     } elseif ($post->post_type == 'answer' && $post->post_parent != 0) {
         $link = get_permalink($post->post_parent) . "?show_answer={$post->ID}#answer_{$post->ID}";
         /**
          * FILTER: ap_answer_post_type_link
          * Allow overriding of answer post type permalink
          */
         return apply_filters('ap_answer_post_type_link', $link, $post);
     }
     return $link;
 }
开发者ID:deepakd92,项目名称:anspress,代码行数:38,代码来源:post_types.php

示例6: term_link_filter

 /**
  * Filter category permalink.
  * @param  string $url      Default taxonomy url.
  * @param  object $term     WordPress term object.
  * @param  string $taxonomy Current taxonomy slug.
  * @return string
  */
 public function term_link_filter($url, $term, $taxonomy)
 {
     if ('question_category' == $taxonomy) {
         if (get_option('permalink_structure') != '') {
             return ap_get_link_to(array('ap_page' => ap_get_category_slug(), 'q_cat' => $term->slug));
         } else {
             return add_query_arg(array('ap_page' => ap_get_category_slug(), 'q_cat' => $term->term_id), ap_base_page_link());
         }
     }
     return $url;
 }
开发者ID:cowlicker12,项目名称:categories-for-anspress,代码行数:18,代码来源:categories-for-anspress.php


注:本文中的ap_base_page_link函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。