Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #8474
    jd5am
    Participant

    Hi there – fantastic plugin, but when I go to Settings -> Download Attachments the admin dashboard, in the Backend Display for Admin Settings, I want to only display Download Attachments for a specific page and not for all pages. How is this possible?

    Thanks a lot!

    #8476
    Bartosz
    Keymaster

    Thanks,

    Yes, of course you can, using da_display_attachments filter hooks like this:

    // don't display attachments to download on pages other than specified
    function df_da_display_attachments( $html ) {
    	if ( ! is_page( 1 ) ) { // any page id, name etc. as in is_page() function
    		$html = '';
    	}
    	return $html;
    }
    add_filter( 'da_display_attachments', 'df_da_display_attachments' );
    #8482
    jd5am
    Participant

    Thanks – that was exactly what I was looking for, except it doesn’t work..

    I pasted the above code into my FUNCTIONS.PHP file and replaced the 1 with ‘downloads’ (i.e. the name of the page) and 2055 (i.e. the id of the post) on a separate occasion. Both times, it displays the Downloads Attachment form in ALL pages (including the ‘downloads’ page). I also went into settings and disabled the ‘page’ tick-box, saved, checked it wasn’t displayed in any of the admin pages and then ticked it back on. Still no joy…

    Help…? What am I doing wrong?

    Thanks again!

    #8520
    Bartosz
    Keymaster

    It should work, that’s what this filter is for.

    Can you post a link to your site?

    #8522
    jd5am
    Participant

    Hi..yes, it’s fintechseisfund.com

    #8531
    Bartosz
    Keymaster

    @jd5am, i see it working as expected. the only page the attachments are displayed is the downloads page.

    or maybe you mean the admin side?

    btw:very nice website, congrats

    #8543
    jd5am
    Participant

    Thanks Bartosz.

    Yes, I meant the admin side. The front-end is fine and works as expected.

    Look forward to your reply.

    #8574
    Bartosz
    Keymaster

    There’s a filter hook for this: da_metabox_limit ( $display, $post_id )
    It contains 2 parameters:
    $display, which is boolean value – wheather to display a metabox or not
    $post_id, where the post id of currently browsed admin post screen value is stored

    This should allow you to fine grain the display.

    #8578
    jd5am
    Participant

    Brilliant – that worked! Magic!

    Thanks again for your help!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.