AnsPress_Admin::options_general_permalinks()

Description #

Register permalinks options.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: admin/anspress-admin.php

	public static function options_general_permalinks() {
		$opt = ap_opt();

		$form = array(
			'submit_label' => __( 'Save Permalinks', 'anspress-question-answer' ),
			'fields'       => array(
				'question_page_slug'      => array(
					'label'    => __( 'Question slug', 'anspress-question-answer' ),
					'desc'     => __( 'Slug for single question page.', 'anspress-question-answer' ),
					'value'    => $opt['question_page_slug'],
					'validate' => 'required',
				),
				'question_page_permalink' => array(
					'label'    => __( 'Question permalink', 'anspress-question-answer' ),
					'desc'     => __( 'Select single question permalink structure.', 'anspress-question-answer' ),
					'type'     => 'radio',
					'options'  => array(
						'question_perma_1' => home_url( '/' . ap_base_page_slug() ) . '/<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/question-name/',
						'question_perma_2' => home_url( '/' ) . '<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/question-name/',
						'question_perma_3' => home_url( '/' ) . '<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/213/',
						'question_perma_4' => home_url( '/' ) . '<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/213/question-name/',
						'question_perma_5' => home_url( '/' ) . '<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/question-name/213/',
						'question_perma_6' => home_url( '/' ) . '<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/213-question-name/',
						'question_perma_7' => home_url( '/' ) . '<b class="ap-base-slug">' . ap_opt( 'question_page_slug' ) . '</b>/question-name-213/',
					),
					'value'    => $opt['question_page_permalink'],
					'validate' => 'required',
				),
				'base_page_title'         => array(
					'label'    => __( 'Base page title', 'anspress-question-answer' ),
					'desc'     => __( 'Main questions list page title', 'anspress-question-answer' ),
					'value'    => $opt['base_page_title'],
					'validate' => 'required',
				),
				'search_page_title'       => array(
					'label'    => __( 'Search page title', 'anspress-question-answer' ),
					'desc'     => __( 'Title of the search page', 'anspress-question-answer' ),
					'value'    => $opt['search_page_title'],
					'validate' => 'required',
				),
				'author_page_title'       => array(
					'label'    => __( 'Author page title', 'anspress-question-answer' ),
					'desc'     => __( 'Title of the author page', 'anspress-question-answer' ),
					'value'    => empty( $opt['author_page_title'] ) ? 'User' : $opt['author_page_title'],
					'validate' => 'required',
				),
			),
		);

		/**
		 * Filter to override permalinks options form.
		 *
		 * @param array $form Form arguments.
		 * @since 4.1.0
		 */
		return apply_filters( 'ap_options_form_permalinks', $form );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment