Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #1161237

    Hello,
    when I choose custom link in the portfolio item, only the image is clickable (the title has no link). How can I make the whole entry box clickable?

    #1162193

    Hey netzhautflimmern,

    Thank you for the inquiry.

    Add this script in the functions.php file to apply the link to the whole grid entry.

    
    add_action('wp_footer', function() {
    	?>
    	<script>
    		(function($) {
    			$(document).ready(function() {
    				$('.grid-entry').on('click', function() {
    					window.location.href = $(this).find('grid-image').attr('href');
    				});
    			});
    		})(jQuery);	
    	</script>
    });
    

    And this css code to show a link pointer when you hover the portfolio entry.

    .grid-entry {
    	cursor: pointer;
    }

    Best regards,
    Ismael

    #1162631

    thanx. When I nisert it into function.php I get the following error:
    syntax error, unexpected end of file

    #1162731

    hm try this instead:

    function shift_link_to_grid(){
    ?>
    <script type="text/javascript">
    (function($) { 
    	$(document).ready(function() {
    		$('.grid-entry').on('click', function() {
    			window.location.href = $(this).find('.grid-image').attr('href');
    		});
    	});	
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'shift_link_to_grid');
    #1162749

    this works, but, in case I have an entry with a manual link to a pdf or an ajax, when I click on the entry outside the image, it opens a new page link: /undefined

    #1162864

    bei deinem Nick gehe ich mal davon aus, dass du Deutsch sprichts.
    Hast du mal einen Link worum es geht. In deiner Beschreibung oben fehlen ein paar Informationen um es nachzubauen.
    Da ist ein Link immer besser um Ratschläge zu geben.

    #1162866

    Hallo, ja genau ;)
    Schau mal hier: https://adlatus.netzhautflimmern.ch/#blog
    Der normale Link auf dem Bild geht zum Artikel, aber wenn ich in den Rest des Kästchens klicke, ist dort jetzt zwar ein Link (nachdem ich die Funktion eingefügt habe), aber der geht ins Leere.
    Also Funktion geht, aber Link wird falsch gesetzt.

    #1162874

    Hi,

    Danke fur das Update.

    There is a little syntax error in this line.

    window.location.href = $(this).find('grid-image').attr('href');
    

    There should be a dot before “grid-image” because it’s supposed to be a class selector.

    window.location.href = $(this).find('.grid-image').attr('href');
    

    It should work propery now.

    Best regards,
    Ismael

    #1162875

    yes i changed it allready on my post above – transmission errors ;)

    #1162876

    perfect, works fine now. thank you very much!!

    #1162879

    really ?

    #1162880

    yeah, already works as I wanted. thank you!!

    #1162891

    click on one link please of the blog ( on the bottom or text )

    #1162914

    ah you’re right, it seems to work for all kind of links except the ajax.
    check https://adlatus.netzhautflimmern.ch/#referenzen
    it opens a new window instead of ajax

    #1162975

    so we had to make the changings only for not ajax protfolios – try this instead please:

    function transfer_link_from_child(){
    ?>
    <script>
    (function($){
    	$(document).ready(function(){  
    		$('.grid-sort-container:not(.grid-links-ajax)').find('.grid-entry .inner-entry').each(function(){
    			var theLink = $(this).find('.grid-image').attr('href'); 
    			$(this).addClass("clickme"); 
    			$(this).on("click", function(){
    				window.location.href = theLink;
    			});	
    		});
    	});
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'transfer_link_from_child');

    i styled it this way:

    .clickme:hover { 
    	cursor: pointer;
    	-webkit-filter: drop-shadow(2px 3px 5px #999);
    	filter: drop-shadow(2px 3px 5px #999);
    }

    i changed the code to containter with .inner-entry class because if you got padding on those the styling could be more precise

    #1162977

    you can see results here on my test-page: https://webers-testseite.de/portfolio/
    Edit : i’m still experimenting a bit – so the example page could be not of the intended function.

    maybe Ismael knows a method to do it for that ajax setup too. Without that selector only for non ajax grids the click on ajax has two click events and does open first the window above the grid – but directly moves to the single portfolio.

    • This reply was modified 5 years ago by Guenni007.
    #1163403

    Hello, thank you.. so this works now for all kinds of portfolio, just the ajax is only working on the images right?

    #1163407

    you see the code above the selector is: grid-entry but to exclude the ajax thing i find it via grid-sort-container
    and to exclude the ajax option there is the not rule
    this is only for grid layout

    #1163412

    ok, so is there a solution, that includes the ajax or is there no possibility?

    #1163956

    Hi,

    Thank you for following up.

    The latest script @Guenni007 provided above should work. The portfolio grids that were set to AJAX will work as is, or they will not be affected by the modification.

    Best regards,
    Ismael

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