victorjonsson / Arlima

Article List Manager - Wordpress plugin suitable for online newspapers that's in need of a fully customizable front page
28 stars 16 forks source link

Search / drag & drop to new truncates content #95

Open ekandreas opened 9 years ago

ekandreas commented 9 years ago

When using drag & drop from search article in Arlima to a list, the content is truncated. How to avoid this feature?

victorjonsson commented 9 years ago

Content of the list or content of the post dragged over to the list?

ekandreas commented 9 years ago

From the search dragged over to a list.

victorjonsson commented 9 years ago

Yes, but I need to know what content that's getting truncated. Do you mean that the content of the list (the articles) dissapears when you drop a post onto the list? Or, do you mean that the body text of the post dissapears once being dropped on a list?

ekandreas commented 9 years ago

Yes, the preamble of the text from the post being dragged is truncated over 100-150 chars. So when my editors creates a new entry from a searched article in Arlima to a list the text truncates.

  1. Search an article in Arlima in your main list page.
  2. Drag the post from the search list to an Arlima list to the left.
  3. The content of the post in Arlima is truncated if its longer than 150 chars or so.

arlima-truncates

victorjonsson commented 9 years ago

Ah, yes. That is the excerpt of the post I believe. Theres probably some wp-filter that you can use. I will look into it

victorjonsson commented 9 years ago

There's no obvious way to modify this behaviour. Here's a quick and dirty solution.

$is_arlima_ajax = defined('DOING_AJAX') && DOING_AJAX && check_ajax_referer('arlima-nonce');
if( $is_arlima_ajax && $_REQUEST['action'] == 'arlima_query_posts' ) {
    add_filter('the_post', function($post) {
        $post->post_excerpt = $post->post_content;
        return $post;
    });
}

Maybe it would be god to let you decide whether or not to use the post excerpt or the post content via a constant in wp-config.php. I will look into it.