• Resolved sarashousha

    (@sarashousha)


    Hello! i am happy with Meow Apps, they are exactly what i need !
    However, I need guidance/help on the filter documentation

    [I am working on Local WordPress 6.7.2, All plugins are Updated ]

    I created a portfolio page populated it using Meow Gallery with images from media library, made it the main homepage, and each image is linked to its prospective post. In the post the image used in the portfolio page is used again with additional progress images, my problem here, whenever I click the image it redirects me again to itself (post page). the rest of the progress images are viewed in lightbox just fine.

    I have tried the ” only enable it in certain pages/posts/classes/id” manually, with help of chatgpt, and Deepseek and it is till now working as i desire.
    I tried creating Galleries from media and from posts, took the id for the filtering codes… still didn’t work
    I pasted the code in the functions.php of Astra, and tried with Code Snippets and still not working (been working on solutions for 6 hours)

    the desirable effect took place only when i enabled the buttons, the button would direct me to the linked post while the image is viewed with lightbox…. ( but it isn’t pleasing in shape or in design) (also it appears everywhere on portfolio/image in post)

    I am aware support is very limited, especially for free users. However, i’d appreciate anyone’s contribution 🙂

    Thanks!

    • This topic was modified 1 year, 1 month ago by sarashousha.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Val Meow

    (@valwa)

    Hey @sarashousha! 👋

    You can use the gallery_custom_links_enabled filter to disable links when viewing a “post”, ensuring that custom links only work on your home page (assuming its post type is not “post”).

    Alternatively, you can modify your setup to assign a specific post type to your home page that differs from the rest, allowing custom links to be enabled only there.

    add_filter( 'gallery_custom_links_enabled', 'my_gallery_custom_links_enabled', 25, 1 );

    function my_gallery_custom_links_enabled( $isEnabled ) {
    if ( is_front_page() ) {
    return true;
    }
    return false;
    }

    If the easiest solution for you is to use the buttons, you can always modify the CSS to make them more aesthetically pleasing or hide them using JS when it’s not your home page—whichever approach works best for you.

    Hope this helps!

    Thread Starter sarashousha

    (@sarashousha)

    @valwa hello!

    thank you for the reply, unfortunately this solution didn’t work for me. I am kinda new to wordpress, and i didn’t get what post type is (other than posts, pages).

    however i added this JS short code snippet, manually to the posts i needed to view the image in ligtbox. I hope i can contribute and update this solution more sustainably, and procedurally.

    document.querySelectorAll('.custom-link, .no-lightbox').forEach(a => {
    a.classList.remove('custom-link', 'no-lightbox');
    });
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Disable links on Posts/ Allowing it on one page only [Astra theme]’ is closed to new replies.