• Resolved cusconative

    (@cusconative)


    Hi, really awesome plugin! It’s almost perfect for what I want to use it for.

    Just one problem, unless I’m missing something obvious, it seems that the only things that can be clickable are the title, the featured image and the link button.

    I need to make the whole grid square clickable including the background image. Think something like Pinterest, where the whole card is clickable.

    Is there any way to do that with this plugin that I am missing, or is there an easy modification that I can make?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Code Amp

    (@codeamp)

    Hey @cusconative

    I’m afraid right now this is the way the plugin works.

    We’re hoping to add functionality as you describe in the future (it still needs discussing), but its going to be a while away yet before we get around to it.

    I’m not sure there is a code snippet / easy change that can be made to do this…

    I think (maybe) the only way you could do it is if you disable all the links within your post template, and then add a link around it yourself via PHP.

    We do have hooks for this kind of thing, but at this stage I’m not sure if what you’re trying would work (and you’d need some PHP experience to do this).

    If you were to give it a go – I would suggest taking a look at the render_output filter for templates (near the bottom of the page):
    https://customlayouts.com/documentation/action-filter-reference/

    And try adjusting this code snippet:

    function template_render_output( $output, $settings ) {
    	// Modify the output
    	$output = 'Before template content' . $output . 'After template content';
    	// Always return in WP filters
    	return $output;
    }
    
    add_filter( 'custom-layouts/template/render_output', 'template_render_output', 10, 2 );

    You can probably (untested) get the current post information from the global post to generate the link:

    global $post;
    echo $post->ID;

    I hope that helps!

    Thread Starter cusconative

    (@cusconative)

    That’s a bummer because it’s an otherwise perfect plugin.

    My PHP knowledge is very limited but I guess I’ll try to give a shot. Thanks for pointing me in the right direction.

    Thread Starter cusconative

    (@cusconative)

    Just wanted to come back and say that this works perfectly. This was the final code that I used:

    function template_render_output( $output, $settings ) {
    	global $post;
    	// Modify the output
    	$output = '<a href="' . get_permalink($post->ID) . '">' . $output . '</a>';
    	// Always return in WP filters
    	return $output;
    }
    
    add_filter( 'custom-layouts/template/render_output', 'template_render_output', 10, 2 );

    Thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make whole block clickable’ is closed to new replies.