This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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']; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
/** | |
* The version 1 endpoint for AnsPress questions. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post__in' => [ 1, 2, 3 ]; | |
); | |
anspress()->questions = new Question_Query( $args ); | |
ap_get_template_part( 'archive' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$category_id = 1; // Replace it. | |
$question_args = array( | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'question_category', | |
'field' => 'id', | |
'terms' => array( $category_id ), | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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