Support » Plugin: Attachments » Show attachments on specific page template

  • Hey, i want to share my solution to connect the attachment plugin only to a specific page template.
    Thanks to:

    Put his code in functions.php

    add_action('admin_enqueue_scripts', 'my_admin_script');
    function my_admin_script()
        wp_enqueue_script('my-admin', get_bloginfo('stylesheet_directory').'/js/my-admin.js', array('jquery'));

    And make a new js-file like this.
    In my example; the ‘template-contact.php’ (Contact template) is showing the attachment plugin.

    $(document).ready(function() {
        var $page_template = $('#page_template')
            ,$metabox = $('#attachments-my_attachments_temp'); // For example
        $page_template.change(function() {
            if ($(this).val() == 'template-contact.php') {
            } else {

    Hope this helps for somebody too.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Show attachments on specific page template’ is closed to new replies.