function init_scripts_front() { if (is_anspress()) { wp_enqueue_script('jquery'); wp_enqueue_script('tagsinput', ap_get_theme_url('js/bootstrap-tagsinput.min.js'), 'jquery', AP_VERSION); wp_enqueue_script('jquery-form', array('jquery'), false, true); wp_enqueue_script('ap-site-js', ANSPRESS_URL . 'assets/ap-site.js', 'jquery', AP_VERSION); wp_enqueue_script('tooltipster', ap_get_theme_url('js/jquery.tooltipster.min.js'), 'jquery', AP_VERSION); wp_enqueue_script('jstorage', ap_get_theme_url('js/jstorage.js'), 'jquery', AP_VERSION); //wp_enqueue_script( 'perfect-scrollbar', ap_get_theme_url('js/perfect-scrollbar.min.js'), 'jquery', AP_VERSION); wp_enqueue_script('ap-js', ap_get_theme_url('js/ap.js'), 'jquery', AP_VERSION); wp_enqueue_style('tagsinput', ap_get_theme_url('css/bootstrap-tagsinput.css'), array(), AP_VERSION); wp_enqueue_style('tooltipster', ap_get_theme_url('css/tooltipster.css'), array(), AP_VERSION); //wp_enqueue_style( 'perfect-scrollbar', ap_get_theme_url('css/perfect-scrollbar.min.css'), array(), AP_VERSION); wp_enqueue_style('ap-style', ap_get_theme_url('css/ap.css'), array(), AP_VERSION); wp_enqueue_style('ap-fonts', ap_get_theme_url('fonts/style.css'), array(), AP_VERSION); do_action('ap_enqueue'); wp_enqueue_style('ap-overrides', ap_get_theme_url('css/overrides.css'), array(), AP_VERSION); ?> <script type="text/javascript"> var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?> ', ap_max_tags = '<?php echo ap_opt('max_tags'); ?> '; </script> <?php wp_localize_script('ap-site-js', 'aplang', array('password_field_not_macthing' => __('Password not matching', 'ap'), 'password_length_less' => __('Password length must be 6 or higher', 'ap'), 'not_valid_email' => __('Not a valid email', 'ap'), 'username_less' => __('Username length must be 4 or higher', 'ap'), 'username_not_avilable' => __('Username not available', 'ap'), 'email_already_in_use' => __('Email already in use', 'ap'), 'loading' => __('Loading', 'ap'), 'sending' => __('Sending request', 'ap'), 'adding_to_fav' => __('Adding question to your favorites', 'ap'), 'voting_on_post' => __('Sending your vote', 'ap'), 'requesting_for_closing' => __('Requesting for closing this question', 'ap'), 'sending_request' => __('Submitting request', 'ap'), 'loading_comment_form' => __('Loading comment form', 'ap'), 'submitting_your_question' => __('Sending your question', 'ap'), 'submitting_your_answer' => __('Sending your answer', 'ap'), 'submitting_your_comment' => __('Sending your comment', 'ap'), 'deleting_comment' => __('Deleting comment', 'ap'), 'updating_comment' => __('Updating comment', 'ap'), 'loading_form' => __('Loading form', 'ap'), 'saving_labels' => __('Saving labels', 'ap'), 'loading_suggestions' => __('Loading suggestions', 'ap'), 'uploading_cover' => __('Uploading cover', 'ap'), 'saving_profile' => __('Saving profile', 'ap'), 'sending_message' => __('Sending message', 'ap'), 'loading_conversation' => __('Loading conversation', 'ap'), 'loading_new_message_form' => __('Loading new message form', 'ap'), 'loading_more_conversations' => __('Loading more conversations', 'ap'), 'searching_conversations' => __('Searching conversations', 'ap'), 'loading_message_edit_form' => __('Loading message form', 'ap'), 'updating_message' => __('Updating message', 'ap'), 'deleting_message' => __('Deleting message', 'ap'), 'uploading' => __('Uploading', 'ap'))); } }
while (ap_questions()) { ap_the_question(); ap_get_template_part('content-list'); } ?> </div> <?php ap_questions_the_pagination(); ?> <?php } else { ap_get_template_part('content-none'); } ?> </div> <?php if (is_active_sidebar('ap-sidebar') && is_anspress()) { ?> <div class="ap-question-right col-md-3"> <?php dynamic_sidebar('ap-sidebar'); ?> </div> <?php } ?> </div>
function ap_get_current_page_template() { if (is_anspress()) { $template = ap_current_page_is(); return apply_filters('ap_current_page_template', $template . '.php'); } return 'content-none.php'; }
/** * Configure which button will appear in wp_editor * @param array $buttons Button names. * @param string $editor_id Editor ID. * @return array */ public function editor_buttons($buttons, $editor_id) { if (is_anspress()) { return array('bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'link', 'unlink', 'blockquote', 'pre'); } return $buttons; }
function ap_get_current_user_page_template() { if (is_anspress()) { $user_page = get_query_var('user_page'); $user_page = $user_page ? $user_page : 'profile'; $template = 'user-' . $user_page . '.php'; return apply_filters('ap_get_current_user_page_template', $template); } return 'content-none.php'; }
/** * 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; }
/** * Add feed and links in HEAD of the document */ public function wp_head() { if (is_anspress()) { $q_feed = get_post_type_archive_feed_link('question'); $a_feed = get_post_type_archive_feed_link('answer'); echo '<link rel="alternate" type="application/rss+xml" title="' . esc_attr__('Question feed', 'ap') . '" href="' . esc_url($q_feed) . '" />'; echo '<link rel="alternate" type="application/rss+xml" title="' . esc_attr__('Answers feed', 'ap') . '" href="' . esc_url($a_feed) . '" />'; } if (is_question() && get_query_var('ap_page') != 'base') { echo '<link rel="canonical" href="' . esc_url(get_permalink(get_question_id())) . '">'; echo '<link rel="shortlink" href="' . esc_url(wp_get_shortlink(get_question_id())) . '" />'; } }
public function editor_plugins($plugin, $editor_id) { if (is_anspress()) { $plugin[] = 'wpautoresize'; } return $plugin; }
<?php echo ap_truncate_chars($category->description, 70); ?> </div> <?php } ?> </div> </li> <?php } ?> </ul> </div> <?php ap_pagination(); ?> </div> <?php if (is_active_sidebar('ap-category') && is_anspress()) { ?> <div class="ap-question-right col-md-3"> <?php dynamic_sidebar('ap-category'); ?> </div> <?php } ?> </div>
public function body_class($classes) { // add anspress class to body if (is_anspress()) { $classes[] = 'anspress'; } // return the $classes array return $classes; }
public function ap_title($title) { if (is_anspress()) { $new_title = ap_page_title(); $new_title = str_replace('[anspress]', $new_title, $title); $new_title = apply_filters('ap_title', $new_title); return $new_title; } return $title; }
function is_ap_user() { if (is_anspress() && get_query_var('ap_page') == 'user') { return true; } return false; }
_e('No description.', 'tags_for_anspress'); } ?> </div> </div> </li> <?php } ?> </ul><!-- close .ap-term-tag-box.clearfix --> <?php ap_pagination(); ?> </div><!-- close #ap-tags --> <?php if (is_active_sidebar('ap-tags') && is_anspress()) { ?> <div class="ap-tags-sidebar col-md-3"> <?php dynamic_sidebar('ap-tags'); ?> </div> <?php } ?> </div><!-- close .row -->
/* Start the Loop */ while (ap_activities()) { ap_the_activity(); ap_get_template_part('activity/item'); } ?> </div> <?php ap_activity_pagination(); ?> <?php } else { ap_get_template_part('content-none'); } ?> </div> <?php if (is_active_sidebar('ap-activity') && is_anspress()) { ?> <div class="ap-question-right col-md-3"> <?php dynamic_sidebar('ap-activity'); ?> </div> <?php } ?> </div>
public function feed_link() { if (is_anspress()) { echo '<link href="' . esc_url(home_url('/feed/question-feed')) . '" title="' . __('Question >> Feed', 'ap') . '" type="application/rss+xml" rel="alternate">'; } }
function ap_qa_on_post($post_id = false) { if (is_anspress()) { return false; } if (!$post_id) { $post_id = get_the_ID(); } $question_args = ap_base_page_main_query($post_id); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $question = new WP_Query($question_args); echo '<div class="anspress">'; echo '<div class="ap-container">'; include ap_get_theme_location('on-post.php'); wp_reset_postdata(); echo '<a href="' . ap_get_link_to('parent/' . get_the_ID()) . '" class="ap-view-all">' . __('View All', 'ap') . '</a>'; echo '</div>'; echo '</div>'; }