• Resolved kvg

    (@kevingaal2015)


    Hello,

    Your plugin seems nice for what I would like to do. I have a gallery on one page that needs custom links. So I would like it to work on that page only:

    I add it to the function.php file and changed the id, but it doesnt work. You said something under it, that get_the_ID (); could not be the right function, but how would I know? I inspected the page and it has page-id-5448. So it should work then right. I mean the page that has the custom links is the only one it should be enabled on right? Thank you in advance for your answer.

    add_filter( 'gallery_custom_links_enabled', 'my_gallery_custom_links_enabled', 25, 1 );
    
    function my_gallery_custom_links_enabled( $isEnabled ) {
    	$id = get_the_ID();
    	if ( $id === 5448 )
    		return true;
    	return false;
    }
Viewing 1 replies (of 1 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    If you don’t use this code, the plugin works, right?

    Indeed, get_the_ID() might not be the right function, and it depends on the page you are trying to get the ID from and the theme. I am sorry but it’s a bit hard to help, I provide this code as an example but you will need to find a way to get the ID for your page, it seems there are so many ways… I would also be very interested to know later what works for you.

Viewing 1 replies (of 1 total)

The topic ‘filter code is not working for me’ is closed to new replies.