is_404 = true; } } function wpatt_job_cpt_template_filter($content) { global $wp_query; $jobID = $wp_query->post->ID; echo get_the_content(); echo '

' . get_option('wpatt_option_localization') . '

'; $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_ID(), 'orderby' => 'menu_order', 'order' => 'desc' ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { echo ''; echo ''; } } } /* Register Settings */ add_action('admin_init', 'wpatt_reg_settings'); function wpatt_reg_settings() { register_setting('wpatt_options_group', 'wpatt_option_showdate', 'intval'); register_setting('wpatt_options_group', 'wpatt_option_localization'); /* Preopulate 'Attachments' */ $wpatt_option_showdate_get = get_option('wpatt_option_showdate'); if (get_option('wpatt_option_localization') == '') { update_option('wpatt_option_localization', 'Attachments'); } } /* Here starts the code for the option panel */ add_action('admin_menu', 'wpatt_plugin_menu'); function wpatt_plugin_menu() { add_options_page('WP Attachments - Settings', 'WP Attachments', 'manage_options', 'wpatt-option-page', 'wpatt_plugin_options'); } function wpatt_plugin_options() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } if (isset($_POST['Submit'])) { $wpatt_option_localization_get = $_POST["wpatt_option_localization_n"]; update_option('wpatt_option_localization', $wpatt_option_localization_get); if (isset($_POST['wpatt_option_showdate_n'])) { update_option('wpatt_option_showdate', '1'); } else { update_option('wpatt_option_showdate', '0'); } } echo '
'; screen_icon(); echo '

Settings

'; echo '
'; echo '
'; settings_fields('wpatt_option_group'); echo ' '; echo ''; echo '
Label for list header  Insert here the label you want to use for the title of the attachments list. Default "Attachments"
Show date?  Check this if you want to show when the file has been uploaded.
'; echo '

'; echo '
'; } ?>