challenge
1 year ago
css
1 day ago
img
1 year ago
js
1 month ago
menu
1 month ago
partials
1 week ago
rest-api
1 day ago
scss
1 year ago
settings
1 day ago
uninstall
1 year ago
wpchill
1 month ago
admin-notices.php
5 months ago
admin.php
1 month ago
class-strong-testimonials-addons.php
1 month ago
class-strong-testimonials-admin-category-list.php
1 year ago
class-strong-testimonials-admin-list.php
1 year ago
class-strong-testimonials-admin-scripts.php
1 month ago
class-strong-testimonials-admin.php
1 month ago
class-strong-testimonials-debug.php
5 months ago
class-strong-testimonials-exporter.php
1 year ago
class-strong-testimonials-help.php
1 year ago
class-strong-testimonials-helper.php
1 month ago
class-strong-testimonials-list-table.php
1 year ago
class-strong-testimonials-lite-vs-pro-page.php
1 month ago
class-strong-testimonials-post-editor.php
6 months ago
class-strong-testimonials-review.php
1 year ago
class-strong-testimonials-updater.php
1 month ago
class-strong-testimonials-upsell.php
1 day ago
class-strong-views-list-table.php
1 month ago
class-walker-strong-category-checklist.php
1 year ago
class-walker-strong-form-category-checklist.php
1 year ago
class-wpmtst-onboarding.php
1 year ago
compat.php
1 year ago
custom-fields-ajax.php
1 year ago
custom-fields.php
1 day ago
form-preview.php
1 year ago
view-list-order.php
1 year ago
views-ajax.php
1 month ago
views-validate.php
1 year ago
views.php
1 month ago
class-strong-testimonials-help.php
286 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Contextual help. |
| 4 | */ |
| 5 | |
| 6 | class Strong_Testimonials_Help { |
| 7 | |
| 8 | public function __construct() {} |
| 9 | |
| 10 | public static function init() { |
| 11 | add_action( 'load-wpm-testimonial_page_testimonial-fields', array( __CLASS__, 'fields_editor' ) ); |
| 12 | add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'views_list' ) ); |
| 13 | add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'shortcode_attributes' ) ); |
| 14 | add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_pagination' ) ); |
| 15 | add_action( 'load-wpm-testimonial_page_testimonial-views', array( __CLASS__, 'view_editor_stretch' ) ); |
| 16 | |
| 17 | add_action( 'load-wpm-testimonial_page_testimonial-settings', array( __CLASS__, 'settings_compat' ) ); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Compatibility settings. |
| 22 | */ |
| 23 | public static function settings_compat() { |
| 24 | if ( ! isset( $_GET['tab'] ) || 'compat' !== sanitize_key( $_GET['tab'] ) ) { |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | ob_start(); |
| 29 | ?> |
| 30 | <p><?php esc_html_e( 'Normally, a web page will load its stylesheets (font, color, size, etc.) before the content. When the content is displayed, the style is ready and the page appears as it was designed.', 'strong-testimonials' ); ?></p> |
| 31 | <p><?php esc_html_e( 'When a browser displays the content before all the stylesheets have been loaded, a flash of unstyled content can occur.', 'strong-testimonials' ); ?></p> |
| 32 | <p> |
| 33 | <?php |
| 34 | printf( |
| 35 | wp_kses( |
| 36 | // translators: %s is the URL to an external explanation about Flash of Unstyled Content (FOUC). |
| 37 | __( '<a href="%s" target="_blank">Explained further here</a>', 'strong-testimonials' ), |
| 38 | array( |
| 39 | 'a' => array( |
| 40 | 'href' => array(), |
| 41 | 'target' => array(), |
| 42 | ), |
| 43 | ) |
| 44 | ), |
| 45 | esc_url( 'https://en.wikipedia.org/wiki/Flash_of_unstyled_content' ) |
| 46 | ); |
| 47 | ?> |
| 48 | | |
| 49 | <?php |
| 50 | printf( |
| 51 | wp_kses( |
| 52 | // translators: %s is the URL to a demonstration on CodePen. |
| 53 | __( '<a href="%s" target="_blank">Demonstrated here</a>', 'strong-testimonials' ), |
| 54 | array( |
| 55 | 'a' => array( |
| 56 | 'href' => array(), |
| 57 | 'target' => array(), |
| 58 | ), |
| 59 | ) |
| 60 | ), |
| 61 | esc_url( 'https://codepen.io/micikato/full/JroPNm/' ) |
| 62 | ); |
| 63 | ?> |
| 64 | | |
| 65 | <?php |
| 66 | printf( |
| 67 | wp_kses( |
| 68 | // translators: %s is the URL to an expert's observations on CSS Tricks. |
| 69 | __( '<a href="%s" target="_blank">An expert\'s observations here</a>', 'strong-testimonials' ), |
| 70 | array( |
| 71 | 'a' => array( |
| 72 | 'href' => array(), |
| 73 | 'target' => array(), |
| 74 | ), |
| 75 | ) |
| 76 | ), |
| 77 | esc_url( 'https://css-tricks.com/fout-foit-foft/' ) |
| 78 | ); |
| 79 | ?> |
| 80 | </p> |
| 81 | <p><?php esc_html_e( 'When this occurs with plugins that use shortcodes, it means the plugin\'s stylesheet was enqueued when the shortcode was rendered so it gets loaded after the content instead of in the normal sequence.', 'strong-testimonials' ); ?></p> |
| 82 | <p><?php esc_html_e( 'The prerender option ensures this plugin\'s stylesheets are loaded before the content.', 'strong-testimonials' ); ?></p> |
| 83 | <?php |
| 84 | $content = ob_get_clean(); |
| 85 | |
| 86 | get_current_screen()->add_help_tab( |
| 87 | array( |
| 88 | 'id' => 'wpmtst-help-prerender', |
| 89 | 'title' => esc_html__( 'Prerender', 'strong-testimonials' ), |
| 90 | 'content' => $content, |
| 91 | ) |
| 92 | ); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Custom fields editor. |
| 97 | */ |
| 98 | public static function fields_editor() { |
| 99 | ob_start(); |
| 100 | ?> |
| 101 | <p><?php esc_html_e( 'These fields let you customize your testimonials to gather the information you need.', 'strong-testimonials' ); ?></p> |
| 102 | <p><?php esc_html_e( 'This editor serves two purposes: (1) to modify the form as it appears on your site, and (2) to modify the custom fields added to each testimonial.', 'strong-testimonials' ); ?></p> |
| 103 | <p><?php esc_html_e( 'The default fields are designed to fit most situations. You can quickly add or remove fields and change several display properties.', 'strong-testimonials' ); ?></p> |
| 104 | <p> |
| 105 | <?php esc_html_e( 'Fields will appear in this order on the form.', 'strong-testimonials' ); ?> |
| 106 | <?php |
| 107 | // translators: %s is the icon for reordering fields. |
| 108 | printf( esc_html__( 'Reorder by grabbing the %s icon.', 'strong-testimonials' ), '<span class="dashicons dashicons-menu"></span>' ); |
| 109 | ?> |
| 110 | </p> |
| 111 | <p><?php esc_html_e( 'To display this form, create a view and select Form mode.', 'strong-testimonials' ); ?></p> |
| 112 | <?php |
| 113 | $content = ob_get_clean(); |
| 114 | |
| 115 | // Links |
| 116 | |
| 117 | $links = array( |
| 118 | '<a href="' . admin_url( 'edit.php?post_type=wpm-testimonial&page=testimonial-settings&tab=form' ) . '">' . __( 'Form settings', 'strong-testimonials' ) . '</a>', |
| 119 | ); |
| 120 | |
| 121 | $content .= '<p>' . implode( ' | ', $links ) . '</p>'; |
| 122 | |
| 123 | get_current_screen()->add_help_tab( |
| 124 | array( |
| 125 | 'id' => 'wpmtst-help', |
| 126 | 'title' => esc_html__( 'Form Fields', 'strong-testimonials' ), |
| 127 | 'content' => $content, |
| 128 | ) |
| 129 | ); |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * About views. |
| 134 | */ |
| 135 | public static function views_list() { |
| 136 | ob_start(); |
| 137 | ?> |
| 138 | <div> |
| 139 | <p><?php esc_html_e( 'A view is simply a group of settings with an easy-to-use editor.', 'strong-testimonials' ); ?> |
| 140 | <p><?php echo wp_kses_post( __( 'You can create an <strong>unlimited</strong> number of views.', 'strong-testimonials' ) ); ?></p> |
| 141 | <p><?php esc_html_e( 'For example:', 'strong-testimonials' ); ?></p> |
| 142 | <ul class="standard"> |
| 143 | <li><?php esc_html_e( 'Create a view to display your testimonials in a list, grid, or slideshow.', 'strong-testimonials' ); ?></li> |
| 144 | <li><?php esc_html_e( 'Create a view to show a testimonial submission form', 'strong-testimonials' ); ?></li> |
| 145 | <li><?php esc_html_e( 'Create a view to append your custom fields to the individual testimonial using your theme single post template.', 'strong-testimonials' ); ?></li> |
| 146 | <?php do_action( 'wpmtst_views_intro_list' ); ?> |
| 147 | </ul> |
| 148 | <p><?php esc_html_e( 'Add a view to a page with its unique shortcode or add it to a sidebar with the Strong Testimonials widget.', 'strong-testimonials' ); ?></p> |
| 149 | </div> |
| 150 | <?php |
| 151 | $content = ob_get_clean(); |
| 152 | |
| 153 | get_current_screen()->add_help_tab( |
| 154 | array( |
| 155 | 'id' => 'wpmtst-help-views', |
| 156 | 'title' => esc_html__( 'About Views', 'strong-testimonials' ), |
| 157 | 'content' => $content, |
| 158 | ) |
| 159 | ); |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Shortcode attributes. |
| 164 | */ |
| 165 | public static function shortcode_attributes() { |
| 166 | if ( ! isset( $_GET['action'] ) ) { |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | ob_start(); |
| 171 | ?> |
| 172 | <div> |
| 173 | <p><?php echo wp_kses_post( __( 'Optional shortcode attributes will override the view settings. Use this to create reusable view <strong>patterns</strong>.', 'strong-testimonials' ) ); ?> |
| 174 | <p><?php echo wp_kses_post( __( 'Overridable settings: <code>post_ids</code>, <code>category</code>, <code>order</code>, <code>count</code>.', 'strong-testimonials' ) ); ?> |
| 175 | <p><?php echo wp_kses_post( esc_html__( 'For example, imagine you have five services, a sales page for each service, and a testimonial category for each service. To display the testimonials on each service page, you can create five duplicate views, one for each category.', 'strong-testimonials' ) ); ?> |
| 176 | <p><?php echo wp_kses_post( __( 'Or you can configure one view as a pattern and add it to each service page with the <code>category</code> attribute.', 'strong-testimonials' ) ); ?> |
| 177 | <p> |
| 178 | <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-1"]</code>' ); ?>, |
| 179 | <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-2"]</code>' ); ?>, etc. |
| 180 | </p> |
| 181 | <p> |
| 182 | <?php echo wp_kses_post( esc_html__( 'Attributes may be used in combination. For example:', 'strong-testimonials' ) ); ?> |
| 183 | <?php echo wp_kses_post( '<code>[testimonial_view id="1" category="service-3" order="random" count="5"]</code>' ); ?> |
| 184 | </p> |
| 185 | <p><?php echo wp_kses_post( __( 'Using <code>post_ids</code> is the most specific method and it will override category and count (whether settings or attributes).', 'strong-testimonials' ) ); ?></p> |
| 186 | </div> |
| 187 | <?php |
| 188 | $content = ob_get_clean(); |
| 189 | |
| 190 | get_current_screen()->add_help_tab( |
| 191 | array( |
| 192 | 'id' => 'wpmtst-help-shortcode', |
| 193 | 'title' => esc_html__( 'Shortcode Attributes', 'strong-testimonials' ), |
| 194 | 'content' => $content, |
| 195 | ) |
| 196 | ); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Pagination comparison. |
| 201 | */ |
| 202 | public static function view_editor_pagination() { |
| 203 | if ( ! isset( $_GET['action'] ) ) { |
| 204 | return; |
| 205 | } |
| 206 | |
| 207 | ob_start(); |
| 208 | ?> |
| 209 | <p><?php esc_html_e( 'Some of the features and drawbacks for each method.', 'strong-testimonials' ); ?></p> |
| 210 | |
| 211 | <table class="wpmtst-help-tab" cellpadding="0" cellspacing="0"> |
| 212 | <thead> |
| 213 | <tr> |
| 214 | <th></th> |
| 215 | <th><?php esc_html_e( 'Simple', 'strong-testimonials' ); ?></th> |
| 216 | <th><?php esc_html_e( 'Standard', 'strong-testimonials' ); ?></th> |
| 217 | </tr> |
| 218 | </thead> |
| 219 | <tbody> |
| 220 | <tr> |
| 221 | <td><?php esc_html_e( 'best use', 'strong-testimonials' ); ?></td> |
| 222 | <td><?php esc_html_e( 'ten pages or less', 'strong-testimonials' ); ?></td> |
| 223 | <td><?php esc_html_e( 'more than ten pages', 'strong-testimonials' ); ?></td> |
| 224 | </tr> |
| 225 | <tr> |
| 226 | <td><?php esc_html_e( 'URLs', 'strong-testimonials' ); ?></td> |
| 227 | <td><?php esc_html_e( 'does not change the URL', 'strong-testimonials' ); ?></td> |
| 228 | <td><?php esc_html_e( 'uses paged URLs just like standard WordPress posts', 'strong-testimonials' ); ?></td> |
| 229 | </tr> |
| 230 | <tr> |
| 231 | <td><?php esc_html_e( 'the Back button', 'strong-testimonials' ); ?></td> |
| 232 | <td><?php esc_html_e( 'It does not remember which page of testimonials you are on. If you click away – for example, on a "Read more" link – then click back, you will return to page one.', 'strong-testimonials' ); ?></td> |
| 233 | <td><?php esc_html_e( 'You will return the last page you were on so this works well with "Read more" links.', 'strong-testimonials' ); ?></td> |
| 234 | </tr> |
| 235 | <tr> |
| 236 | <td><?php esc_html_e( 'works with random order option', 'strong-testimonials' ); ?></td> |
| 237 | <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td> |
| 238 | <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td> |
| 239 | </tr> |
| 240 | <tr> |
| 241 | <td><?php esc_html_e( 'works in a widget', 'strong-testimonials' ); ?></td> |
| 242 | <td><?php esc_html_e( 'yes', 'strong-testimonials' ); ?></td> |
| 243 | <td><?php esc_html_e( 'no', 'strong-testimonials' ); ?></td> |
| 244 | </tr> |
| 245 | </tbody> |
| 246 | </table> |
| 247 | <?php |
| 248 | $content = ob_get_clean(); |
| 249 | |
| 250 | get_current_screen()->add_help_tab( |
| 251 | array( |
| 252 | 'id' => 'wpmtst-help-pagination', |
| 253 | 'title' => esc_html__( 'Pagination', 'strong-testimonials' ), |
| 254 | 'content' => $content, |
| 255 | ) |
| 256 | ); |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Slideshow stretch explanation. |
| 261 | */ |
| 262 | public static function view_editor_stretch() { |
| 263 | if ( ! isset( $_GET['action'] ) ) { |
| 264 | return; |
| 265 | } |
| 266 | |
| 267 | ob_start(); |
| 268 | ?> |
| 269 | <p><?php echo wp_kses_post( __( 'This will set the height of the <b>slideshow container</b> to match the tallest slide in order to keep elements below it from bouncing up and down during slide transitions. With testimonials of uneven length, the result is whitespace underneath the shorter testimonials.', 'strong-testimonials' ) ); ?></p> |
| 270 | <p><?php echo wp_kses_post( __( 'Select the <b>Stretch</b> option to stretch the borders and background vertically to compensate.', 'strong-testimonials' ) ); ?></p> |
| 271 | <p><?php esc_html_e( 'Use the excerpt or abbreviated content if you want to minimize the whitespace.', 'strong-testimonials' ); ?></p> |
| 272 | <?php |
| 273 | $content = ob_get_clean(); |
| 274 | |
| 275 | get_current_screen()->add_help_tab( |
| 276 | array( |
| 277 | 'id' => 'wpmtst-help-stretch', |
| 278 | 'title' => esc_html__( 'Stretch', 'strong-testimonials' ), |
| 279 | 'content' => $content, |
| 280 | ) |
| 281 | ); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | Strong_Testimonials_Help::init(); |
| 286 |