AnsPress_Profile_Hooks::user_pages()
Description #
Register user profile pages.
Source #
File: addons/free/profile.php
public static function user_pages() { if ( ! empty( anspress()->user_pages ) ) { return; } anspress()->user_pages = array( array( 'slug' => 'questions', 'label' => __( 'Questions', 'anspress-question-answer' ), 'icon' => 'apicon-question', 'cb' => [ __CLASS__, 'question_page' ], 'order' => 2, ), array( 'slug' => 'answers', 'label' => __( 'Answers', 'anspress-question-answer' ), 'icon' => 'apicon-answer', 'cb' => [ __CLASS__, 'answer_page' ], 'order' => 2, ), ); do_action( 'ap_user_pages' ); foreach ( (array) anspress()->user_pages as $key => $args ) { $rewrite = ap_opt( 'user_page_slug_' . $args['slug'] ); $title = ap_opt( 'user_page_title_' . $args['slug'] ); // Override user page slug. if ( empty( $args['rewrite'] ) ) { anspress()->user_pages[ $key ]['rewrite'] = ! empty( $rewrite ) ? sanitize_title( $rewrite ) : $args['slug']; } // Override user page title. if ( ! empty( $title ) ) { anspress()->user_pages[ $key ]['label'] = $title; } // Add default order. if ( ! isset( $args['order'] ) ) { anspress()->user_pages[ $key ]['order'] = 10; } } anspress()->user_pages = ap_sort_array_by_order( anspress()->user_pages ); }
Expand full source code Collapse full source code View on GitHub: addons/free/profile.php:143
Add your comment