View functions.php
<?php | |
/** | |
* This hook will make question title to be more than 100 characters. | |
* | |
* @param array $form Form arguments. | |
* @return array | |
*/ | |
function my_ap_make_question_description_optional( $form ) { | |
$validate = $form['fields']['post_title']['validate']; | |
View anspress-category-field-override.php
<?php | |
/** | |
* Override AnsPress form category field selection list. | |
* | |
* @param mixed $form | |
* @return mixed | |
*/ | |
function anspress_override_category_field( $form ){ | |
$form['fields']['category'] = array( | |
'label' => __( 'Category', 'anspress-question-answer' ), |
View pre-commit
#!/bin/sh | |
MESSAGE="$1" | |
VERSION_PATH=`git rev-parse --show-toplevel`"/style.css" | |
VER_TOKEN="Version:" | |
VER_STR=$(grep "$VER_TOKEN" $VERSION_PATH | awk '{print $2}' | tr -d '"') | |
VER_MAJ=$(echo $VER_STR | awk -F. '{print $1}') | |
VER_MIN=$(echo $VER_STR | awk -F. '{print $2}') |
View rest-questions.php
<?php | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
/** | |
* The version 1 endpoint for AnsPress questions. | |
*/ |
View functions.php
<?php | |
/** | |
* Hook to filter comments form. | |
* | |
* @param array $form Comment form | |
*/ | |
add_filter( 'ap_comment_form_fields', function( $form ) { | |
$form['fields']['content']['min_length'] = 1; | |
return $form; |
View functions.php
<?php | |
$args = array( | |
'post__in' => [ 1, 2, 3 ]; | |
); | |
anspress()->questions = new Question_Query( $args ); | |
ap_get_template_part( 'archive' ); |
View category.php
<?php | |
$category_id = 1; // Replace it. | |
$question_args = array( | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'question_category', | |
'field' => 'id', | |
'terms' => array( $category_id ), | |
), |
View functions.php
<?php | |
/** | |
* Filter AnsPress question permastruct. | |
* | |
* @param array $structure Question rules. | |
* @return array | |
*/ | |
function my_ap_question_perm_structure( $structure ) { | |
add_rewrite_tag( '%question_category%', '([^/]+)' ); | |
$question_slug = ap_get_page_slug( 'question' ); |
View functions.php
<?php | |
/** | |
* Filters question CPT args. | |
*/ | |
function my_ap_question_cpt_args( $args ) { | |
$args['exclude_from_search'] = false; | |
return $args; | |
} | |
add_filter( 'ap_question_cpt_args', 'my_ap_question_cpt_args' ); |
View functions.php
<?php | |
function ap_ap_vote_btn_html( 'ap_vote_btn_html', $html, $post ) { | |
$html = str_replace( 'apicon-thumb-up', 'fa fa-angle-double-up', $html ); | |
// $html = str_replace( 'apicon-thumb-down', 'fa fa-angle-double-up', $html ); | |
return $html; | |
} | |
add_filter( 'ap_vote_btn_html', 'ap_ap_vote_btn_html', 10, 2 ); |
NewerOlder