Display posts side by side with custom query

Not sure how your final html should look, but I guess it’s: <ul> <li>…</li> <li>…</li> <li>…</li> </ul> In that case, you should move the ul element outside the while loop and your code should look like this: <ul> <?php while ($agendaHome->have_posts()) { $agendaHome->the_post(); ?> <li>rest of the code goes here</li> <?php } ?> </ul> Also … Read more

Wp includes access control

Considering you got an Apache server, use this full code in the .htaccess file: # Block the include-only files. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ – [F,L] RewriteRule !^wp-includes/ – [S=3] RewriteRule ^wp-includes/[^/]+\.php$ – [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+\.php – [F,L] RewriteRule ^wp-includes/theme-compat/ – [F,L] </IfModule> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / … Read more

How to query most recent post for each author?

You can write a SQL query to achieve this: <?php $sql = <<<SQL SELECT p.ID, p.post_title, p.post_author FROM {$GLOBALS[‘wpdb’]->posts} p INNER JOIN ( SELECT ID, post_title FROM {$GLOBALS[‘wpdb’]->posts} ORDER BY post_date DESC ) s ON p.ID=s.ID WHERE p.post_type=”post” AND p.post_status=”publish” GROUP BY p.post_author SQL; $rows = $GLOBALS[‘wpdb’]->get_results( $sql );

Display Search Results by tag_ID in my search.php

Filter it using pre_get_posts, like this: function searchfilter($query) { if ($query->is_search && !is_admin() ) { if(isset($_GET[‘venue_type_search’])) { $venue_type = $_GET[‘venue_type_search’]; $query->set(‘tag’,array($venue_type)); } } return $query; } add_filter(‘pre_get_posts’,’searchfilter’);