File "class-pp-attachment.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/powerpack-elements/classes/class-pp-attachment.php
File
size: 979 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
if (!class_exists('PP_Attachment')) {
class PP_Attachment
{
public function __construct()
{
add_filter('attachment_fields_to_edit', array($this, 'custom_attachment_field_link'), 10, 2);
add_filter('attachment_fields_to_save', array($this, 'custom_attachment_field_link_save'), 10, 2);
}
public function custom_attachment_field_link($form_fields, $post)
{
$form_fields['pp-custom-link'] = array('label' => __('PP - Custom Link', 'powerpack'), 'input' => 'text', 'value' => get_post_meta($post->ID, 'pp-custom-link', true));
return $form_fields;
}
public function custom_attachment_field_link_save($post, $attachment)
{
if (isset($attachment['pp-custom-link'])) {
update_post_meta($post['ID'], 'pp-custom-link', $attachment['pp-custom-link']);
}
return $post;
}
}
new PP_Attachment();
}