PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.8.0
GiveWP – Donation Plugin and Fundraising Platform v3.8.0
4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / includes / post-types.php
give / includes Last commit date
admin 2 years ago api 3 years ago database 2 years ago deprecated 3 years ago donors 2 years ago emails 3 years ago forms 2 years ago frontend 6 years ago gateways 2 years ago libraries 2 years ago payments 2 years ago actions.php 5 years ago ajax-functions.php 2 years ago class-give-async-process.php 2 years ago class-give-background-updater.php 2 years ago class-give-cache-setting.php 2 years ago class-give-cache.php 3 years ago class-give-cli-commands.php 3 years ago class-give-comment.php 6 years ago class-give-cron.php 6 years ago class-give-donate-form.php 2 years ago class-give-donor.php 2 years ago class-give-email-access.php 5 years ago class-give-license-handler.php 4 years ago class-give-logging.php 5 years ago class-give-readme-parser.php 4 years ago class-give-roles.php 6 years ago class-give-scripts.php 2 years ago class-give-session.php 5 years ago class-give-stats.php 6 years ago class-give-template-loader.php 6 years ago class-give-tooltips.php 6 years ago class-give-translation.php 4 years ago class-notices.php 2 years ago country-functions.php 5 years ago currencies-list.php 3 years ago currency-functions.php 3 years ago error-tracking.php 6 years ago filters.php 3 years ago formatting.php 2 years ago install.php 2 years ago login-register.php 2 years ago misc-functions.php 2 years ago plugin-compatibility.php 6 years ago post-types.php 5 years ago price-functions.php 6 years ago process-donation.php 2 years ago setting-functions.php 6 years ago shortcodes.php 2 years ago template-functions.php 4 years ago user-functions.php 3 years ago
post-types.php
586 lines
1 <?php
2 /**
3 * Post Type Functions
4 *
5 * @package Give
6 * @subpackage Functions
7 * @copyright Copyright (c) 2016, GiveWP
8 * @license https://opensource.org/licenses/gpl-license GNU Public License
9 * @since 1.0
10 */
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Registers and sets up the Donation Forms (give_forms) custom post type
19 *
20 * @return void
21 * @since 1.0
22 */
23 function give_setup_post_types() {
24
25 // Give Forms single post and archive options.
26 $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular', 'enabled' ) );
27 $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives', 'enabled' ) );
28
29 // Enable/Disable give_forms links if form is saving.
30 if ( Give_Admin_Settings::is_saving_settings() ) {
31 if ( isset( $_POST['forms_singular'] ) ) {
32 $give_forms_singular = give_is_setting_enabled( give_clean( $_POST['forms_singular'] ) );
33 flush_rewrite_rules();
34 }
35
36 if ( isset( $_POST['forms_archives'] ) ) {
37 $give_forms_archives = give_is_setting_enabled( give_clean( $_POST['forms_archives'] ) );
38 flush_rewrite_rules();
39 }
40 }
41
42 $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
43 // Support for old 'GIVE_FORMS_SLUG' constant
44 if ( defined( 'GIVE_FORMS_SLUG' ) ) {
45 $give_forms_slug = GIVE_FORMS_SLUG;
46 }
47
48 $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : [
49 'slug' => $give_forms_slug,
50 'with_front' => false,
51 ];
52
53 $give_forms_labels = apply_filters(
54 'give_forms_labels',
55 [
56 'name' => __( 'Donation Forms', 'give' ),
57 'singular_name' => __( 'Form', 'give' ),
58 'add_new' => __( 'Add Form', 'give' ),
59 'add_new_item' => __( 'Add New Donation Form', 'give' ),
60 'edit_item' => __( 'Edit Donation Form', 'give' ),
61 'new_item' => __( 'New Form', 'give' ),
62 'all_items' => __( 'All Forms', 'give' ),
63 'view_item' => __( 'View Form', 'give' ),
64 'search_items' => __( 'Search Forms', 'give' ),
65 'not_found' => __( 'No forms found.', 'give' ),
66 'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ),
67 'parent_item_colon' => '',
68 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
69 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ),
70 ]
71 );
72
73 // Default give_forms supports.
74 $give_form_supports = [
75 'title',
76 'thumbnail',
77 'excerpt',
78 'revisions',
79 'author',
80 ];
81
82 // Has the user disabled the excerpt?
83 if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
84 unset( $give_form_supports[2] );
85 }
86
87 // Has user disabled the featured image?
88 if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
89 unset( $give_form_supports[1] );
90 remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
91 }
92
93 $give_forms_args = [
94 'labels' => $give_forms_labels,
95 'public' => $give_forms_singular,
96 'show_ui' => true,
97 'show_in_menu' => true,
98 'show_in_rest' => true,
99 'query_var' => true,
100 'rewrite' => $give_forms_rewrite,
101 'map_meta_cap' => true,
102 'capability_type' => 'give_form',
103 'has_archive' => $give_forms_archives,
104 'menu_icon' => 'dashicons-give',
105 'hierarchical' => false,
106 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ),
107 ];
108 register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
109
110 /** Donation Post Type */
111 $payment_labels = [
112 'name' => _x( 'Donations', 'post type general name', 'give' ),
113 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ),
114 'add_new' => __( 'Add New', 'give' ),
115 'add_new_item' => __( 'Add New Donation', 'give' ),
116 'edit_item' => __( 'Edit Donation', 'give' ),
117 'new_item' => __( 'New Donation', 'give' ),
118 'all_items' => __( 'All Donations', 'give' ),
119 'view_item' => __( 'View Donation', 'give' ),
120 'search_items' => __( 'Search Donations', 'give' ),
121 'not_found' => __( 'No donations found.', 'give' ),
122 'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ),
123 'parent_item_colon' => '',
124 'menu_name' => __( 'Donations', 'give' ),
125 ];
126
127 $payment_args = [
128 'labels' => apply_filters( 'give_payment_labels', $payment_labels ),
129 'public' => false,
130 'query_var' => false,
131 'rewrite' => false,
132 'map_meta_cap' => true,
133 'capability_type' => 'give_payment',
134 'supports' => [ 'title' ],
135 'can_export' => true,
136 ];
137 register_post_type( 'give_payment', $payment_args );
138
139 }
140
141 add_action( 'init', 'give_setup_post_types', 1 );
142
143
144 /**
145 * Give Setup Taxonomies
146 *
147 * Registers the custom taxonomies for the give_forms custom post type
148 *
149 * @return void
150 * @since 1.0
151 */
152 function give_setup_taxonomies() {
153
154 $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
155
156 /** Categories */
157 $category_labels = [
158 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ),
159 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ),
160 'search_items' => __( 'Search Categories', 'give' ),
161 'all_items' => __( 'All Categories', 'give' ),
162 'parent_item' => __( 'Parent Category', 'give' ),
163 'parent_item_colon' => __( 'Parent Category:', 'give' ),
164 'edit_item' => __( 'Edit Category', 'give' ),
165 'update_item' => __( 'Update Category', 'give' ),
166 'add_new_item' => __( 'Add New Category', 'give' ),
167 'new_item_name' => __( 'New Category Name', 'give' ),
168 'menu_name' => __( 'Categories', 'give' ),
169 ];
170
171 $category_args = apply_filters(
172 'give_forms_category_args',
173 [
174 'hierarchical' => true,
175 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ),
176 'show_ui' => true,
177 'show_in_rest' => true,
178 'query_var' => 'give_forms_category',
179 'rewrite' => [
180 'slug' => $slug . '/category',
181 'with_front' => false,
182 'hierarchical' => true,
183 ],
184 'capabilities' => [
185 'manage_terms' => 'manage_give_form_terms',
186 'edit_terms' => 'edit_give_form_terms',
187 'assign_terms' => 'assign_give_form_terms',
188 'delete_terms' => 'delete_give_form_terms',
189 ],
190 ]
191 );
192
193 /** Tags */
194 $tag_labels = [
195 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ),
196 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ),
197 'search_items' => __( 'Search Tags', 'give' ),
198 'all_items' => __( 'All Tags', 'give' ),
199 'parent_item' => __( 'Parent Tag', 'give' ),
200 'parent_item_colon' => __( 'Parent Tag:', 'give' ),
201 'edit_item' => __( 'Edit Tag', 'give' ),
202 'update_item' => __( 'Update Tag', 'give' ),
203 'add_new_item' => __( 'Add New Tag', 'give' ),
204 'new_item_name' => __( 'New Tag Name', 'give' ),
205 'menu_name' => __( 'Tags', 'give' ),
206 'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ),
207 ];
208
209 $tag_args = apply_filters(
210 'give_forms_tag_args',
211 [
212 'hierarchical' => false,
213 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ),
214 'show_ui' => true,
215 'show_in_rest' => true,
216 'query_var' => 'give_forms_tag',
217 'rewrite' => [
218 'slug' => $slug . '/tag',
219 'with_front' => false,
220 'hierarchical' => true,
221 ],
222 'capabilities' => [
223 'manage_terms' => 'manage_give_form_terms',
224 'edit_terms' => 'edit_give_form_terms',
225 'assign_terms' => 'assign_give_form_terms',
226 'delete_terms' => 'delete_give_form_terms',
227 ],
228 ]
229 );
230
231 // Does the user want category?
232 $enable_category = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
233
234 // Does the user want tag?
235 $enable_tag = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
236
237 // Enable/Disable category and tag if form is saving.
238 if ( Give_Admin_Settings::is_saving_settings() ) {
239 if ( isset( $_POST['categories'] ) ) {
240 $enable_category = give_is_setting_enabled( give_clean( $_POST['categories'] ) );
241 flush_rewrite_rules();
242 }
243
244 if ( isset( $_POST['tags'] ) ) {
245 $enable_tag = give_is_setting_enabled( give_clean( $_POST['tags'] ) );
246 flush_rewrite_rules();
247 }
248 }
249
250 if ( $enable_category ) {
251 register_taxonomy( 'give_forms_category', [ 'give_forms' ], $category_args );
252 register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
253 }
254
255 if ( $enable_tag ) {
256 register_taxonomy( 'give_forms_tag', [ 'give_forms' ], $tag_args );
257 register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
258 }
259 }
260
261 add_action( 'init', 'give_setup_taxonomies', 0 );
262
263
264 /**
265 * Get Default Form Labels
266 *
267 * @return array $defaults Default labels
268 * @since 1.0
269 */
270 function give_get_default_form_labels() {
271 $defaults = [
272 'singular' => __( 'Form', 'give' ),
273 'plural' => __( 'Forms', 'give' ),
274 ];
275
276 return apply_filters( 'give_default_form_name', $defaults );
277 }
278
279 /**
280 * Get Singular Forms Label
281 *
282 * @param bool $lowercase
283 *
284 * @return string $defaults['singular'] Singular label
285 * @since 1.0
286 */
287 function give_get_forms_label_singular( $lowercase = false ) {
288 $defaults = give_get_default_form_labels();
289
290 return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
291 }
292
293 /**
294 * Get Plural Forms Label
295 *
296 * @return string $defaults['plural'] Plural label
297 * @since 1.0
298 */
299 function give_get_forms_label_plural( $lowercase = false ) {
300 $defaults = give_get_default_form_labels();
301
302 return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
303 }
304
305 /**
306 * Change default "Enter title here" input
307 *
308 * @param string $title Default title placeholder text
309 *
310 * @return string $title New placeholder text
311 * @since 1.0
312 */
313 function give_change_default_title( $title ) {
314 // If a frontend plugin uses this filter (check extensions before changing this function)
315 if ( ! is_admin() ) {
316 $title = __( 'Enter form title here', 'give' );
317
318 return $title;
319 }
320
321 $screen = get_current_screen();
322
323 if ( 'give_forms' == $screen->post_type ) {
324 $title = __( 'Enter form title here', 'give' );
325 }
326
327 return $title;
328 }
329
330 add_filter( 'enter_title_here', 'give_change_default_title' );
331
332 /**
333 * Registers Custom Post Statuses which are used by the Payments
334 *
335 * @return void
336 * @since 1.0
337 */
338 function give_register_post_type_statuses() {
339 // Payment Statuses
340 register_post_status(
341 'refunded',
342 [
343 'label' => __( 'Refunded', 'give' ),
344 'public' => true,
345 'exclude_from_search' => false,
346 'show_in_admin_all_list' => true,
347 'show_in_admin_status_list' => true,
348 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
349 ]
350 );
351 register_post_status(
352 'failed',
353 [
354 'label' => __( 'Failed', 'give' ),
355 'public' => true,
356 'exclude_from_search' => false,
357 'show_in_admin_all_list' => true,
358 'show_in_admin_status_list' => true,
359 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
360 ]
361 );
362 register_post_status(
363 'revoked',
364 [
365 'label' => __( 'Revoked', 'give' ),
366 'public' => true,
367 'exclude_from_search' => false,
368 'show_in_admin_all_list' => true,
369 'show_in_admin_status_list' => true,
370 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
371 ]
372 );
373 register_post_status(
374 'cancelled',
375 [
376 'label' => __( 'Cancelled', 'give' ),
377 'public' => true,
378 'exclude_from_search' => false,
379 'show_in_admin_all_list' => true,
380 'show_in_admin_status_list' => true,
381 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
382 ]
383 );
384 register_post_status(
385 'abandoned',
386 [
387 'label' => __( 'Abandoned', 'give' ),
388 'public' => true,
389 'exclude_from_search' => false,
390 'show_in_admin_all_list' => true,
391 'show_in_admin_status_list' => true,
392 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
393 ]
394 );
395 register_post_status(
396 'processing',
397 [
398 'label' => _x( 'Processing', 'Processing payment status', 'give' ),
399 'public' => true,
400 'exclude_from_search' => false,
401 'show_in_admin_all_list' => true,
402 'show_in_admin_status_list' => true,
403 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' ),
404 ]
405 );
406
407 register_post_status(
408 'preapproval',
409 [
410 'label' => _x( 'Preapproval', 'Preapproval payment status', 'give' ),
411 'public' => true,
412 'exclude_from_search' => false,
413 'show_in_admin_all_list' => true,
414 'show_in_admin_status_list' => true,
415 'label_count' => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ),
416 ]
417 );
418
419 }
420
421 add_action( 'init', 'give_register_post_type_statuses' );
422
423 /**
424 * Updated Messages
425 *
426 * Returns an array of with all updated messages.
427 *
428 * @param array $messages Post updated message
429 *
430 * @return array $messages New post updated messages
431 * @since 1.0
432 */
433 function give_updated_messages( $messages ) {
434 global $post, $post_ID;
435
436 if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) {
437
438 $messages['give_forms'] = [
439 1 => __( 'Form updated.', 'give' ),
440 4 => __( 'Form updated.', 'give' ),
441 6 => __( 'Form published.', 'give' ),
442 7 => __( 'Form saved.', 'give' ),
443 8 => __( 'Form submitted.', 'give' ),
444 ];
445
446 } else {
447
448 $messages['give_forms'] = [
449 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
450 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
451 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
452 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
453 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
454 ];
455
456 }
457
458 return $messages;
459 }
460
461 add_filter( 'post_updated_messages', 'give_updated_messages' );
462
463 /**
464 * Ensure post thumbnail support is turned on
465 */
466 function give_add_thumbnail_support() {
467 if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
468 return;
469 }
470
471 if ( ! current_theme_supports( 'post-thumbnails' ) ) {
472 add_theme_support( 'post-thumbnails' );
473 }
474
475 add_post_type_support( 'give_forms', 'thumbnail' );
476 }
477
478 add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
479
480 /**
481 * Give Sidebars
482 *
483 * This option adds Give sidebars; registered late so it display last in list
484 */
485 function give_widgets_init() {
486
487 // Single Give Forms (disabled if single turned off in settings)
488 if (
489 give_is_setting_enabled( give_get_option( 'forms_singular' ) )
490 && give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
491 ) {
492
493 register_sidebar(
494 apply_filters(
495 'give_forms_single_sidebar',
496 [
497 'name' => __( 'GiveWP Single Form Sidebar', 'give' ),
498 'id' => 'give-forms-sidebar',
499 'description' => __( 'Widgets in this area will be shown on the single GiveWP forms aside area. This sidebar will not display for embedded forms.', 'give' ),
500 'before_widget' => '<div id="%1$s" class="widget %2$s">',
501 'after_widget' => '</div>',
502 'before_title' => '<h3 class="widgettitle widget-title">',
503 'after_title' => '</h3>',
504 ]
505 )
506 );
507
508 }
509 }
510
511 add_action( 'widgets_init', 'give_widgets_init', 999 );
512
513
514 /**
515 * Remove "Quick Edit" for the give_forms CPT.
516 *
517 * @param array $actions
518 * @param null $post
519 *
520 * @return array
521 * @since 2.3.0
522 */
523 function give_forms_disable_quick_edit( $actions = [], $post = null ) {
524
525 // Abort if the post type is not "give_forms".
526 if ( ! is_post_type_archive( 'give_forms' ) ) {
527 return $actions;
528 }
529
530 // Remove the Quick Edit link.
531 if ( isset( $actions['inline hide-if-no-js'] ) ) {
532 unset( $actions['inline hide-if-no-js'] );
533 }
534
535 // Return the set of links without Quick Edit.
536 return $actions;
537
538 }
539
540 add_filter( 'post_row_actions', 'give_forms_disable_quick_edit', 10, 2 );
541
542 /**
543 * Removes the screen options pull down. It is reset later in a different position.
544 *
545 * @param bool $display_boolean Whether to display screen options.
546 * @param WP_Screen $wp_screen_object The screen object.
547 *
548 * @return bool Whether to display screen options.
549 * @since 2.5.0
550 */
551 function give_remove_screen_options( $display_boolean, $wp_screen_object ) {
552
553 if ( false !== strpos( $wp_screen_object->id, 'give' ) ) {
554 return false;
555 }
556
557 // Don't mess with other screens.
558 return $display_boolean;
559 }
560
561 // add_filter( 'screen_options_show_screen', 'give_remove_screen_options', 10, 2 );
562
563 /**
564 * Renders the screen options back after admin bar to ensure it pushes down the banner rather than overlaps them as is default in WordPress.
565 *
566 * @since 2.5.0
567 */
568 function give_render_screen_options() {
569 if ( ! is_admin() ) {
570 return;
571 }
572
573 $current_screen = get_current_screen();
574
575 if ( empty( $current_screen ) ) {
576 return;
577 }
578
579 if ( false !== strpos( $current_screen->id, 'give' ) ) {
580 // Render Screen Options above the banner.
581 $current_screen->render_screen_meta();
582 }
583 }
584
585 add_action( 'wp_after_admin_bar_render', 'give_render_screen_options' );
586