Changeset 3460924
- Timestamp:
- 02/13/2026 04:55:47 PM (6 weeks ago)
- Location:
- faqz/trunk
- Files:
-
- 4 edited
-
faqz.php (modified) (13 diffs)
-
includes/widgets.php (modified) (1 diff)
-
languages/faqz.pot (modified) (3 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
faqz/trunk/faqz.php
r3460870 r3460924 5 5 Plugin URI: https://github.com/benhuson/FAQz 6 6 Description: Simple management of Frequently Asked Questions (FAQ) via post type and categories. 7 Version: 1.08 Requires at least: 3.57 Version: 2.0 8 Requires at least: 4.7 9 9 Requires PHP: 7.4 10 10 Author: Ben Huson … … 58 58 add_action( 'template_redirect', array( $this, 'template_redirect' ) ); 59 59 add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); 60 add_filter( 'cmspo_post_types', array( $this, 'cmspo_post_types' ) ); 61 add_shortcode( 'faqz', array( $this, 'shortcode_faqz' ) ); 60 add_shortcode( 'faqs', array( $this, 'shortcode_faqs' ) ); 62 61 63 62 } … … 90 89 'query_var' => true, 91 90 'rewrite' => array( 92 'slug' => _x( 'faq z', 'Single URL slug', 'faqz' ),91 'slug' => _x( 'faqs', 'Single URL slug', 'faqz' ), 93 92 'with_front' => false 94 93 ), … … 98 97 'menu_position' => null, 99 98 'menu_icon' => 'dashicons-format-chat', 100 'supports' => array( 'title', 'editor', 'author', ' excerpt' )99 'supports' => array( 'title', 'editor', 'author', 'page-attributes' ) 101 100 ); 102 101 103 register_post_type( 'faqz', apply_filters( 'faqz_register_post_type_args', $args ));102 register_post_type( $this->get_registered_post_type(), $args ); 104 103 105 104 } … … 113 112 'hierarchical' => true, 114 113 'labels' => array( 115 'name' => _x( ' Categories', 'taxonomy general name', 'faqz' ),116 'singular_name' => _x( ' Category', 'taxonomy singular name', 'faqz' ),117 'search_items' => __( 'Search Categories', 'faqz' ),118 'all_items' => __( 'All Categories', 'faqz' ),119 'parent_item' => __( 'Parent Category', 'faqz' ),120 'parent_item_colon' => __( 'Parent Category:', 'faqz' ),121 'edit_item' => __( 'Edit Category', 'faqz' ),122 'update_item' => __( 'Update Category', 'faqz' ),123 'add_new_item' => __( 'Add New Category', 'faqz' ),124 'new_item_name' => __( 'New Category Name', 'faqz' ),125 'menu_name' => __( 'Categor y', 'faqz' ),114 'name' => _x( 'FAQ Categories', 'taxonomy general name', 'faqz' ), 115 'singular_name' => _x( 'FAQ Category', 'taxonomy singular name', 'faqz' ), 116 'search_items' => __( 'Search FAQ Categories', 'faqz' ), 117 'all_items' => __( 'All FAQ Categories', 'faqz' ), 118 'parent_item' => __( 'Parent FAQ Category', 'faqz' ), 119 'parent_item_colon' => __( 'Parent FAQ Category:', 'faqz' ), 120 'edit_item' => __( 'Edit FAQ Category', 'faqz' ), 121 'update_item' => __( 'Update FAQ Category', 'faqz' ), 122 'add_new_item' => __( 'Add New FAQ Category', 'faqz' ), 123 'new_item_name' => __( 'New FAQ Category Name', 'faqz' ), 124 'menu_name' => __( 'Categories', 'faqz' ), 126 125 ), 127 126 'public' => true, … … 130 129 'query_var' => true, 131 130 'rewrite' => array( 132 'slug' => 'faq z-category',131 'slug' => 'faq-category', 133 132 'with_front' => false 134 133 ), 135 134 ); 136 135 137 register_taxonomy( 'faqz_category', array( 'faqz' ), apply_filters( 'faqz_register_taxonomy_args', $args ));136 register_taxonomy( $this->get_registered_taxonomy(), array( $this->get_registered_post_type() ), $args ); 138 137 139 138 } … … 176 175 177 176 /** 178 * Support for CMS Page Order plugin 179 * http://wordpress.org/extend/plugins/cms-page-order/ 180 * 181 * @param array $post_types Exisiting post type support. 182 * @return array Updated post type support. 183 */ 184 function cmspo_post_types( $post_types ) { 185 186 $post_types[] = 'faqz'; 187 return $post_types; 177 * Get Registered Post Type 178 * 179 * @return string 180 */ 181 public function get_registered_post_type() { 182 183 return sanitize_key( apply_filters( 'faqz_registered_post_type', 'faq' ) ); 184 185 } 186 187 /** 188 * Get Registered Taxonomy 189 * 190 * @return string 191 */ 192 public function get_registered_taxonomy() { 193 194 return sanitize_key( apply_filters( 'faqz_registered_taxonomy', 'faq_category' ) ); 188 195 189 196 } … … 194 201 public function template_redirect() { 195 202 196 if ( is_search() && ( is_post_type_archive( 'faq z' ) || ( is_archive() && 'faqz' == get_post_type() ) ) ) {197 198 $search_template = locate_template( 'search-faq z.php' );203 if ( is_search() && ( is_post_type_archive( 'faq' ) || ( is_archive() && 'faq' == get_post_type() ) ) ) { 204 205 $search_template = locate_template( 'search-faq.php' ); 199 206 200 207 if ( '' != $search_template ) { … … 217 224 do_action( 'faqz_get_search_form' ); 218 225 219 $search_form_template = locate_template( 'searchform-faq z.php' );220 if ( '' != $search_form_template ) {226 $search_form_template = locate_template( 'searchform-faq.php' ); 227 if ( '' !== $search_form_template ) { 221 228 require( $search_form_template ); 222 229 return; 223 230 } 224 231 225 $form = '<form role="search" method="get" id="faq z-searchform" action="' . esc_url( get_post_type_archive_link( 'faqz' ) ) . '" >226 <div><label class="screen-reader-text" for="faq z-s">' . __( 'Search for:', 'faqz' ) . '</label>227 <input type="text" value="' . get_search_query() . '" name="s" id="faqz-s" />228 <input type="submit" id="faq z-searchsubmit" value="'. esc_attr__( 'Search', 'faqz' ) .'" />232 $form = '<form role="search" method="get" id="faq-searchform" class="faq-searchform" action="' . esc_url( get_post_type_archive_link( 'faq' ) ) . '" > 233 <div><label class="screen-reader-text" for="faq-searchform-s">' . __( 'Search for:', 'faqz' ) . '</label> 234 <input type="text" value="' . esc_attr( get_search_query() ) . '" name="s" id="faq-searchform-s" /> 235 <input type="submit" id="faq-searchform-submit" value="'. esc_attr__( 'Search', 'faqz' ) .'" /> 229 236 </div> 230 237 </form>'; … … 241 248 242 249 /** 243 * Shortcode: [faq /]250 * Shortcode: [faqs /] 244 251 * 245 252 * @param array $atts Shortcode attributes. … … 247 254 * @return string Content. 248 255 */ 249 public function shortcode_faqz( $atts, $content = '' ) { 250 251 $atts = wp_parse_args( $atts, array( 252 'faqz_context' => 'shortcode' 253 ) ); 256 public function shortcode_faqs( $atts, $content = '', $shortcode_tag = '' ) { 257 258 $atts = wp_parse_args( $atts, array() ); 254 259 255 260 return $content . $this->faqz_list( $atts ); … … 270 275 'orderby' => 'menu_order', 271 276 'order' => 'ASC', 272 'faqz_context' => 'list', 273 'faqz_before' => '<div class="faqz-faqs">', 277 'faqz_before' => '<div class="faqs">', 274 278 'faqz_after' => '</div>', 275 'faqz_before_item' => '<div class="faq z-faq">',279 'faqz_before_item' => '<div class="faq">', 276 280 'faqz_after_item' => '</div>' 277 281 ) ); 278 $args['post_type'] = 'faqz';282 $args['post_type'] = $this->get_registered_post_type(); 279 283 280 284 $faqs = ''; … … 286 290 $faqs_query->the_post(); 287 291 288 $faq = '<h3 class="faq z-question"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';289 $faq .= '<div class="faq z-answer">' . get_the_content() . '</div>';292 $faq = '<h3 class="faq__question"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; 293 $faq .= '<div class="faq__answer">' . get_the_content() . '</div>'; 290 294 $faqs .= $args['faqz_before_item'] . apply_filters( 'faqz_loop', $faq, $args ) . $args['faqz_after_item']; 291 295 -
faqz/trunk/includes/widgets.php
r3460870 r3460924 14 14 15 15 $widget_ops = array( 16 'classname' => 'faq z-widget-search',16 'classname' => 'faq-widget-search', 17 17 'description' => __( 'An FAQ search form', 'faqz' ) 18 18 ); -
faqz/trunk/languages/faqz.pot
r3460870 r3460924 3 3 msgstr "" 4 4 "Project-Id-Version: FAQs\n" 5 "POT-Creation-Date: 2026-02-13 1 4:22+0000\n"5 "POT-Creation-Date: 2026-02-13 16:54+0000\n" 6 6 "PO-Revision-Date: 2012-10-11 07:02-0000\n" 7 7 "Last-Translator: Ben Huson <ben@thewhiteroom.net>\n" … … 19 19 "X-Poedit-SearchPath-0: ..\n" 20 20 21 #: ../faqz.php:7 2 ../faqz.php:8421 #: ../faqz.php:71 ../faqz.php:83 22 22 msgid "FAQs" 23 23 msgstr "" 24 24 25 #: ../faqz.php:7 325 #: ../faqz.php:72 26 26 msgid "FAQ" 27 27 msgstr "" 28 28 29 #: ../faqz.php:7 429 #: ../faqz.php:73 30 30 msgid "Add New" 31 31 msgstr "" 32 32 33 #: ../faqz.php:7 533 #: ../faqz.php:74 34 34 msgid "Add New FAQ" 35 35 msgstr "" 36 36 37 #: ../faqz.php:7 637 #: ../faqz.php:75 38 38 msgid "Edit FAQ" 39 39 msgstr "" 40 40 41 #: ../faqz.php:7 741 #: ../faqz.php:76 42 42 msgid "New FAQ" 43 43 msgstr "" 44 44 45 #: ../faqz.php:7 845 #: ../faqz.php:77 46 46 msgid "All FAQs" 47 47 msgstr "" 48 48 49 #: ../faqz.php:7 949 #: ../faqz.php:78 50 50 msgid "View FAQ" 51 51 msgstr "" 52 52 53 #: ../faqz.php: 8053 #: ../faqz.php:79 54 54 msgid "Search FAQs" 55 55 msgstr "" 56 56 57 #: ../faqz.php:8 157 #: ../faqz.php:80 58 58 msgid "No FAQs found" 59 59 msgstr "" 60 60 61 #: ../faqz.php:8 261 #: ../faqz.php:81 62 62 msgid "No FAQs found in Trash" 63 63 msgstr "" 64 64 65 #: ../faqz.php:92 66 msgid "faqz" 65 #: ../faqz.php:91 66 msgid "faqs" 67 msgstr "" 68 69 #: ../faqz.php:114 70 msgid "FAQ Categories" 67 71 msgstr "" 68 72 69 73 #: ../faqz.php:115 74 msgid "FAQ Category" 75 msgstr "" 76 77 #: ../faqz.php:116 78 msgid "Search FAQ Categories" 79 msgstr "" 80 81 #: ../faqz.php:117 82 msgid "All FAQ Categories" 83 msgstr "" 84 85 #: ../faqz.php:118 86 msgid "Parent FAQ Category" 87 msgstr "" 88 89 #: ../faqz.php:119 90 msgid "Parent FAQ Category:" 91 msgstr "" 92 93 #: ../faqz.php:120 94 msgid "Edit FAQ Category" 95 msgstr "" 96 97 #: ../faqz.php:121 98 msgid "Update FAQ Category" 99 msgstr "" 100 101 #: ../faqz.php:122 102 msgid "Add New FAQ Category" 103 msgstr "" 104 105 #: ../faqz.php:123 106 msgid "New FAQ Category Name" 107 msgstr "" 108 109 #: ../faqz.php:124 70 110 msgid "Categories" 71 111 msgstr "" 72 112 73 #: ../faqz.php:116 ../faqz.php:125 74 msgid "Category" 75 msgstr "" 76 77 #: ../faqz.php:117 78 msgid "Search Categories" 79 msgstr "" 80 81 #: ../faqz.php:118 82 msgid "All Categories" 83 msgstr "" 84 85 #: ../faqz.php:119 86 msgid "Parent Category" 87 msgstr "" 88 89 #: ../faqz.php:120 90 msgid "Parent Category:" 91 msgstr "" 92 93 #: ../faqz.php:121 94 msgid "Edit Category" 95 msgstr "" 96 97 #: ../faqz.php:122 98 msgid "Update Category" 99 msgstr "" 100 101 #: ../faqz.php:123 102 msgid "Add New Category" 103 msgstr "" 104 105 #: ../faqz.php:124 106 msgid "New Category Name" 107 msgstr "" 108 109 #: ../faqz.php:154 113 #: ../faqz.php:153 110 114 #, php-format 111 115 msgid "FAQ updated. <a href=\"%s\">View FAQ</a>" 112 116 msgstr "" 113 117 114 #: ../faqz.php:15 5118 #: ../faqz.php:154 115 119 msgid "Custom field updated." 116 120 msgstr "" 117 121 118 #: ../faqz.php:15 6122 #: ../faqz.php:155 119 123 msgid "Custom field deleted." 120 124 msgstr "" 121 125 122 #: ../faqz.php:15 7126 #: ../faqz.php:156 123 127 msgid "FAQ updated." 124 128 msgstr "" 125 129 126 #: ../faqz.php:15 9130 #: ../faqz.php:158 127 131 #, php-format 128 132 msgid "FAQ restored to revision from %s" 129 133 msgstr "" 130 134 131 #: ../faqz.php:16 1135 #: ../faqz.php:160 132 136 #, php-format 133 137 msgid "FAQ published. <a href=\"%s\">View FAQ</a>" 134 138 msgstr "" 135 139 136 #: ../faqz.php:16 2140 #: ../faqz.php:161 137 141 msgid "FAQ saved." 138 142 msgstr "" 139 143 140 #: ../faqz.php:16 4144 #: ../faqz.php:163 141 145 #, php-format 142 146 msgid "FAQ submitted. <a target=\"_blank\" href=\"%s\">Preview FAQ</a>" 143 147 msgstr "" 144 148 145 #: ../faqz.php:16 6149 #: ../faqz.php:165 146 150 #, php-format 147 151 msgid "" … … 150 154 msgstr "" 151 155 152 #: ../faqz.php:16 8156 #: ../faqz.php:167 153 157 msgid "M j, Y @ G:i" 154 158 msgstr "" 155 159 156 #: ../faqz.php:1 70160 #: ../faqz.php:169 157 161 #, php-format 158 162 msgid "FAQ draft updated. <a target=\"_blank\" href=\"%s\">Preview FAQ</a>" 159 163 msgstr "" 160 164 161 #: ../faqz.php:2 26165 #: ../faqz.php:233 162 166 msgid "Search for:" 163 167 msgstr "" 164 168 165 #: ../faqz.php:2 28169 #: ../faqz.php:235 166 170 msgid "Search" 167 171 msgstr "" -
faqz/trunk/readme.txt
r3460873 r3460924 3 3 Donate link: https://www.paypal.com/ncp/payment/P64UGJHU5MZVE 4 4 Tags: faq, faqs, questions, answers, knowledgebase 5 Requires at least: 3.55 Requires at least: 4.7 6 6 Tested up to: 6.9 7 Stable tag: 1.07 Stable tag: 2.0 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 18 18 It consists of: 19 19 20 * A simple 'faq z' post type21 * [faq z/] shortcode20 * A simple 'faq' post type 21 * [faqs /] shortcode 22 22 * FAQ search widget 23 23 * FAQ search form template tag … … 34 34 This is just a first release. More to come... 35 35 36 = Why so many breaking changes in version 2.0? = 37 38 The main post type was changed to `faq` so the plugin is easier to migrate to/from other FAQ plugins. Front end CSS classes were changed to reflect this and follow a more predictable BEM format. Code and plugin hooks retained their `faqz` namespace. It is possible to reinstate some backward compatibility using the filters mentioned in the changelog and updating your template names and CSS files. 39 36 40 == Screenshots == 37 41 … … 40 44 41 45 == Changelog == 46 47 = 2.0 = 48 * Breaking Change: Post type `faqz` is now `faq`. Use `faqz_registered_post_type` filter for backwards compatibility. 49 * Breaking Change: Taxonomy `faqz-category` is now `faq-category`. Use `faqz_registered_taxonomy` filter for backwards compatibility. 50 * Breaking Change: Post type single and archive URL slug is now `faqs` instead of `faqz`. Use `register_faq_post_type_args` filter to change. 51 * Breaking Change: Category URL slug is now `faq-category` instead of `faqz-category`. Use `register_faq-category_taxonomy_args` filter to change. 52 * Breaking Change: `faqz` shortcode is now `faqs`. 53 * Breaking Change: Removed `faqz_register_post_type_args` filter. Use `register_faq_post_type_args`. 54 * Breaking Change: Removed `faqz_register_taxonomy_args` filter. Use `register_faq-category_taxonomy_args`. 55 * Breaking Change: Optional template `search-faq.php` changed to `search-faqz.php`. 56 * Breaking Change: Optional template `searchform-faqz.php` changed to `searchform-faq.php`. 57 * Breaking Change: `faqz_context` arg removed from faqz_list() display method. 58 * Breaking Change: CSS classes for search form and default FAQs output changed. 42 59 43 60 = 1.0 =
Note: See TracChangeset
for help on using the changeset viewer.