• Resolved belyvolk

    (@belyvolk)


    Good day!

    Can make it so that in the Simple Portfolio the Captions is not clickable, but only a photo?

    Добрый день, мой английский очень плох, потому продублирую на русском.
    Возможно ли сделать так, чтобы в Simple Portfolio нажималась только фотография, а подписи не были кликабельными?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi there.

    Are you able to provide a link to your gallery so that I can have a look for you?

    Thanks in advance,

    Phill

    Thread Starter belyvolk

    (@belyvolk)

    Good day

    Here is a link to the gallery: https://shainurau.com/en/figurative/

    The whole problem is that in the description I have links and they are not convenient to use

    Wow! Amazing images!

    @steveush – are you able to confirm whether we can disable the link on the caption area of the gallery items so that only the image is clickable?

    • This reply was modified 5 years, 9 months ago by phillcoxon.
    Thread Starter belyvolk

    (@belyvolk)

    Thank you very much, I am very pleased!

    Plugin Author steveush

    (@steveush)

    Hi @belyvolk,

    You should be able to accomplish this with some custom JS to unbind the pass through clicks that occur on the caption. The below JS should accomplish this:

    (function(_){
    
    	if (!_) return;
    	
    	_.PortfolioTemplate.prototype.onParsedItem = _.PortfolioTemplate.prototype.onCreatedItem = function(event, template, item){
    		item.$el.find(".fg-caption").off("click.foogallery");
    	};
    
    })(window.FooGallery);

    That said it needs to be enqueued into your page to actually work. To do this you can add the following PHP snippet to your functions.php file or by using a plugin that includes snippets for you:

    function foogallery_enqueue_custom_js(){ ?>
        <script type="text/javascript">
        (function(_){
    	
    		if (!_) return;
    
            _.PortfolioTemplate.prototype.onParsedItem = _.PortfolioTemplate.prototype.onCreatedItem = function(event, template, item){
                item.$el.find(".fg-caption").off("click.foogallery");
            };
    
        })(window.FooGallery);
        </script><?php
    }
    add_action( 'wp_footer', 'foogallery_enqueue_custom_js', 999 );

    Thanks

    Thread Starter belyvolk

    (@belyvolk)

    Hi @steveush,

    I added the PHP snippet to functions.php. However, nothing has changed. Maybe I did something wrong.

    • This reply was modified 5 years, 9 months ago by belyvolk.
    • This reply was modified 5 years, 9 months ago by belyvolk.
    Plugin Author steveush

    (@steveush)

    Hi @belyvolk,

    No everything you did seems correct. In the snippet we used the wp_footer action to try ensure the custom script was included last in the page as it needs to come after the FooGallery scripts. Unfortunately your optimization plugin is combining all scripts and then including them only after the custom JS so they are not taking effect.

    In the snippet I provided you can see the number 999 towards the end, this specifies the priority/order the script is included in the page. I can only assume your optimization plugin is using a similar method but with a larger value for priority, bigger numbers mean the script is included lower down. Please try simply adding an additional 9 to the 999 making it 9999 and seeing if this rectifies the issue. If not try another 9 making it 99999 and so on.

    Thanks

    Thread Starter belyvolk

    (@belyvolk)

    Hi @steveush,
    thanks, now everything works

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Captions in Simple Portfolio’ is closed to new replies.