'.$title.'
'; $defaultOptions = array( 'numberpost' => 5, 'orderby' => 'date' ); $selectedCategories = get_option('aa_displayed_cat'); if (is_array($selectedCategories)){ foreach($selectedCategories as $selectedCategory){ $posts = get_posts( array_merge( array( 'category' => $selectedCategory ), $defaultOptions ) ); /** * To display the date and author : * '.date('d/m/Y', strtotime($post->post_date)).' '.__('by', 'articleaccordion').' '.$user->user_nicename.' */ if ($posts){ foreach($posts as $post){ $user = get_userdata($post->post_author); $content = $post->post_content; preg_match('!]*src="([^"]+)".*/>!', $content, $matches); $content = preg_replace('!(<[^>]+>)!', '', $content); $content = substr($content, 0, 140).'...'; if (is_array($matches) && count($matches)) $content = '
'.$content.'
'; $string .= '

'.$post->post_title.'

'.$content.'

'.__('Read more', 'articleaccordion').'

'; if (--$max_articles <= 0) break 2; } } } } echo $string.'
'; ?>