PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 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 All 255 releases
give / includes / admin / forms / metabox.php

metabox.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at includes/admin/forms/metabox.php

45 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Metabox Functions
4 *
5 * @package Give
6 * @subpackage Admin/Forms
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 /**
19 * Add Shortcode Copy Field to Publish Metabox
20 *
21 * @since: 1.0
22 */
23 function give_add_shortcode_to_publish_metabox() {
24
25 if ( 'give_forms' !== get_post_type() ) {
26 return false;
27 }
28 global $post;
29
30 // Only enqueue scripts for CPT on post type screen
31 if ( 'give_forms' === $post->post_type ) {
32 // Shortcode column with select all input
33 $shortcode = sprintf( '[give_form id="%s"]', absint( $post->ID ) );
34 printf(
35 '<div class="misc-pub-section"><button type="button" class="button hint-tooltip hint--top js-give-shortcode-button" aria-label="%1$s" data-give-shortcode="%2$s"><span class="dashicons dashicons-admin-page"></span> %3$s</button></div>',
36 esc_attr( $shortcode ),
37 esc_attr( $shortcode ),
38 esc_html__( 'Copy Shortcode', 'give' )
39 );
40 }
41
42 }
43
44 add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
45