Update post meta with wp cron
Update post meta with wp cron
Update post meta with wp cron
Figured out a solution that works for the issue I was having. This should be able to place an ‘Ads’ custom post type every 3rd post of ‘Articles’ custom post type. <?php // $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $get_posts = new WP_Query(array( ‘post_type’ => ‘articles’, ‘post_status’ =>’publish’, … Read more
I actually had a duplicate of $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
You need to add an if statement current loop to print out a year container around your articles. <?php if( have_posts() ) : ?> <?php $current_year = date(‘Y’); // Get the current year and set it $first = true; // Set a $first variable; while ( have_posts() ) : the_post(); if ( $first || get_the_date(‘Y’) … Read more
Rather than relying on a literal menu, you could use wp_list_pages possibly to better effect and sort out by certain criteria if you wish, then foreach page, display terms. Here is a little function I wrote to spit out terms for a taxonomy passed to it: // give taxonomy, will return link list to custom … Read more
One solution would be to give a value of “none” to your posts without any post group, similarly as you have “uncategorized” posts in WP Categories. Alternatively… I haven’t checked it, but why don’t you try to make another WP_QUERY like this: new WP_Query( array( ‘post_type’ => ‘page’, ‘page_group’ => ” ) )
Use something like this for each column. <!– custom field = ‘normal’ –> <div class=”span2 normal”> <?php // The Query $the_query = new WP_Query( array( ‘meta_key’ => ‘your_custom_field_name’, ‘meta_value’ => ‘normal’ ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo ‘<div class=”post”> <h1>’ . get_the_title() . ‘</h1> </div>’; endwhile; // Reset Post Data … Read more
Try this: Paste it on functions.php (not tested) add_action(‘template_redirect’, ‘my_user_redirect’); function my_user_redirect(){ if(!is_user_logged_in()){ // only redirect use not logged in wp_redirect( home_url( ‘welcome’ ), 301 ); exit; } } Let me know if it worked.
Run through the loop once and break when the sticky post is found. If it’s not found, rewind the query and output the first found result: <?php if ( $featured_value_cat_query->have_posts() ) { $count = 0; while ( $featured_value_cat_query->have_posts() ): $featured_value_cat_query->the_post(); if ( ‘yes’ == get_field(‘seacoast_value_sticky_value’) ) { $count = 1; ?> // Post Content would … Read more
If only you could use get_categories() reference in the Codex, you could see that this function supports arguments. <?php $categories = get_categories( array( ‘orderby’ => ‘name’, // default value, can omit it ‘order’ => ‘DESC’ )); foreach($categories as $cat) { // your code goes here }