template_detail_box_content('');
?>
Affiliate-Toolkit Shortcode';
$target = is_string( $args ) ? $args : 'content';
// Prepare args
$args = wp_parse_args( $args, array(
'target' => $target,
'text' => __( 'Affiliate-Toolkit shortcodes', ATKP_PLUGIN_PREFIX ),
'class' => 'button',
'icon' => plugins_url( 'images/affiliate_toolkit_menu.png', ATKP_PLUGIN_FILE ),
'echo' => true,
'shortcode' => false
) );
// Prepare icon
if ( $args['icon'] ) $args['icon'] = '
';
// Print button
$button = '' . $args['icon'] . $args['text'] . '';
add_action( 'wp_footer', array(&$this, 'shortcode_popup' ) );
add_action( 'admin_footer', array(&$this, 'shortcode_popup' ) );
wp_register_style( 'magnific-popup', plugins_url( 'css/magnific-popup.css', ATKP_PLUGIN_FILE ), false, '0.9.9', 'all' );
wp_register_script( 'magnific-popup', plugins_url( 'js/magnific-popup.js', ATKP_PLUGIN_FILE ), array( 'jquery' ), '0.9.9', true );
wp_localize_script( 'magnific-popup', 'atkp_magnific_popup', array(
'close' => __( 'Close (Esc)', ATKP_PLUGIN_PREFIX ),
'loading' => __( 'Loading...', ATKP_PLUGIN_PREFIX ),
'prev' => __( 'Previous (Left arrow key)', ATKP_PLUGIN_PREFIX ),
'next' => __( 'Next (Right arrow key)', ATKP_PLUGIN_PREFIX ),
'counter' => sprintf( __( '%s of %s', ATKP_PLUGIN_PREFIX ), '%curr%', '%total%' ),
'error' => sprintf( __( 'Failed to load this link. %sOpen link%s.', ATKP_PLUGIN_PREFIX ), '', '' )
) );
wp_enqueue_style( 'magnific-popup' );
wp_enqueue_script( 'magnific-popup' );
if ( $args['echo'] )
echo $button;
else
return $button;
}
function shortcode_boxes() {
$types = array( 'post', 'page' );
foreach( $types as $type ) {
//add_meta_box(
// ATKP_SHORTCODE.'_detail_box',
// __( 'Affiliate Toolkit Shortcodes', ATKP_PLUGIN_PREFIX),
// array(&$this, 'template_detail_box_content'),
// $type,
// 'side',
// 'default'
//);
add_meta_box(
ATKP_PLUGIN_PREFIX.'_product_box',
__( 'Affiliate Toolkit Product', ATKP_PLUGIN_PREFIX),
array(&$this, 'product_detail_box_content'),
$type,
'normal',
'default'
);
}
}
function product_detail_box_content( $post )
{
wp_nonce_field( plugin_basename( __FILE__ ), 'product_detail_box_content_nonce' );
?>
array( 'post', 'page' ), // YOUR POST TYPE
'post_status' => array('publish', 'draft'),
'meta_query' => array(
array(
'key' => ATKP_PLUGIN_PREFIX.'_product',
'value' => $productid,
'compare' => '=',
'type' => 'CHAR',
),
),
);
// The Query
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
array_push($postids, $query->post->ID);
}
}
wp_reset_postdata();
ATKPTools::set_post_setting( $productid, ATKP_PRODUCT_POSTTYPE.'_postid', $postids);
}
}
function template_detail_box_content( $post ) {
?>