New answers tagged


The solution is to use: 'taxonomy' => 'meal', 'field' => 'slug', 'terms' => 'breakfast' The taxonomy and terms are obvious, but why does field have to be slug? When you add taxonomy parameters, you can specify what 'breakfast' is-- via the field. It could be the term's ID, the full name, or slug. See the codex on Taxonomy Parameters


I found the problem. Here is the solution in case someone stumbles upon a similar problem. I had a filter in my functions.php that limited the showed posts on several custom taxonomies and the default value was set in the else statement // Customizing posts per page on zitate archive function limit_posts_per_archive_page() { if ( is_post_type_archive( ...


You'll have to code the output in the manner you want to display it. However you'll have to generate the image link prior to the html part. Save the image in a variable $bgimage1; make the list using li and in the list item backgroun-image: <?php echo $bgimage1; ?>


In order to remove the duplicate posts, I used the below process in one of the theme I worked on. Create a global variable Store the post ID of first loop on the variable On next loop, use post__not_in to remove the already shown posts. Or, you can also check if current post id is in array of global variable and skip that post.


global $wpdb; $excludeposts = "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND meta_key NOT LIKE %aa_% ORDER BY post_date DESC "; $main_query = new WP_Query( array( 'post__not_in' => $excludeposts, 'paged' => $paged ) ); while ($main_query->have_posts()) : $main_query->the_post(); //Stuff... endwhile; ...


I have figured out how to do this. It was somewhat close to what ankittiwaari suggested, but he didn't give a few key details. When you pass a variable under data in an ajax call, it automatically makes it a $_POST request assuming you are calling method: 'post' So I did what ankittiwaari said and created <input type="hidden" value="<?= ...


Assign the value of you $_POST variable to a html element or javascript variable in front-page.php like //html element <input type="hidden" value="<?= $_POST['variable']?>" id="post-variable"> or in javascript variable var postVariable = "<?= $_POST['variable']?>"; Now in ajax call, you can get the value as var myValue = ...

Top 50 recent answers are included