Last active
November 2, 2019 02:07
-
-
Save robdecker/51e14ea355ee98eac6b9 to your computer and use it in GitHub Desktop.
[Views: only display a views attachment of the first page of results] #d7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function yourmodule_views_post_build($view) { | |
$view_name = 'the_id_of_the_view'; | |
// The display ID of the main view display. | |
$display_id = 'page_1'; | |
if ($view->name == $view_name && $view->current_display == $display_id) { | |
$current_page = $view->get_current_page(); | |
// Hide the attachments on all pages beside the first one. | |
if ($current_page > 0) { | |
$view->attachment_before = ''; | |
$view->attachment_after = ''; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment