Views promoted/sticky items I have a view of all content, of all types, listed by date order. Paginated of course (with load more).

I want to find the latest piece of content of type X, and promote it/make it stick to the first result.

I was initially just going to use an attachment, but this comes with 2 problems.


The item ideally won't repeat
If it is already the first item, or in the first few results, there will be 2 right next to each other.


The item should not persist as the first item on each page, it should just be moved/re-ordered.

I feel like this should be very straight forward, but I am drawing a blank. 

Any help most appreciated!
One thing you can do is set up a "sticky" view which pulls out the node you're looking for and then store the nid of the node.  You could do this using hook_views_post_execute() in a custom module like so:

function MYMODULE_views_post_execute(&amp;$view) {
  $nid = &amp;drupal_static('MYMODULE_sticky_node_id');
  if(!empty($view-&gt;result)) {
    $nid = $view-&gt;result[0]-&gt;nid; // (or similar)
  }
}


(Replace all instances of "MYMODULE" with your module name)

Now if there is a result then it's nid should be stored in a static variable called 'MYMODULE_sticky_node_id'.

Next add a contextual filter of NID to the main view, leave "When the filter value is NOT in the URL" as "Display all results for the specified field", and under the "More" fieldset, tick "Exclude".

Next implement something like hook_views_pre_view():

function MYMODULE_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
  if ($view-&gt;name == 'your_main_view_name') { // If need be add "&amp;&amp; $display_id == 'your_main_view_display_name'
    if ($nid = drupal_static('MYMODULE_sticky_node_id')) {
      $view-&gt;set_arguments(array($nid));
    }
  }
}


This will pull out the nid you saved while processing the sticky view and set it as the argument of the main view, therefore excluding it from that view.

You'll need to make sure that the sticky view is rendered before the main view for this to work.

Bear in mind that I haven't tested this exact code so it might need some tweaking to get it to work in context.