A form that can save/edit after first input
A form that can save/edit after first input
A form that can save/edit after first input
Dynamic Custom Fields
You are using WP_query, try to change your loop to: <?php if ($wp_query->have_posts() ): while ($wp_query->have_posts() ) : $wp_query->the_post(); // Do stuff here endwhile; endif; wp_reset_postdata(); ?>
I managed to fix it! As I suspected it had nothing to do with the code relating to $number, but rather the echo call before it. My initial code looked like this (I’m skipping part of the loop content to keep it simple): echo ‘<p style=”color:grey;font-size:11px;margin:0;”>(‘ . $number = intval(get_post_meta(get_the_ID(), ‘number’, true)); if($number > 1){ … Read more
Is this happening if you remove the pre_get_posts hook? Either way, you can try wrapping the code in a conditional. while (have_posts() ) : the_post(); if ( 0 < intval( the_ID() ) { … } endwhile; This is not quite as good as limiting the number of records returned by the query but it doesn’t … Read more
I ended up doing the following: Custom post type for Deals: Custom taxonomies for Countries and Activities, then a relational link between country from and country to as custom fields to the taxonomy 🙂
the_content filter on some post types only not working
Your issue is definitely caused by the lack of a pre_get_posts filter. Try this in your theme/functions.php: // so event cpt is found on assigned cat archive page function jdk540_event_query_post_type($query) { if ( ! is_admin() ) { if( is_category() || is_tag() && $query->is_main_query() && empty( $query->query_vars[‘suppress_filters’] ) ) { $post_type = get_query_var(‘post_type’); if($post_type) $post_type = … Read more
Don’t run the query twice. Use get_posts($args) instead of new WP_Query. Then use array_slice() to generate to arrays of equal length and loop through them that way. array_slice() help: https://stackoverflow.com/questions/5393028/how-can-i-take-an-array-divide-it-by-two-and-create-two-lists
There are a few ways to accomplish what you are trying to do. The first and easiest thing that I think I would try is to replace your call to is_home() with is_ftont_page(). Read here for the difference between the two. If that doesn’t fix your issue, you could try making a call to WP_query … Read more