Link to page with posts of specific type

First, never use query_posts, use WP_Query to create additional queries. When you register your post type, set has_archive to true, or a string which will be the URL slug for your post type archive. You can then use get_post_type_archive_link() to output the URL to your post type archive. <a href=”https://wordpress.stackexchange.com/questions/210453/<?php echo get_post_type_archive_link(“issues’ ); ?>”><li>View All</li></a>

Custom pagination (Previous / Next)

Well… pretty much just do exactly what you said. Add a class conditionally based on the number of links O.o $link_container_class=””; if (!empty($links)) { if( 1 === count( $links ) ) { $link_container_class=”single”; } ?> <nav class=”post-nav clear clearfix <?php echo $link_container_class; ?>”> <ul><?php echo implode($links); ?> </ul> </nav><?php } ?>

`update_post_meta` not working anymore

get_the_ID() is a “Loop” function. It won’t outside the Loop, and there is not Loop in your code. Essentially, you are passing a bad ID to the function causing it to fail. If you had debugging enabled you might see feedback to that effect. You are also using a variable– $dateStart— that is not set … Read more

Only show posts from the last trailing 12 months

This is how I did it in the end – <?php $post_args = array( ‘post_type’ => ‘tribe_events’, ‘eventDisplay’=>’custom’, ‘start_date’ => date( ‘Y-m-d H:i:s’, strtotime( ‘-365 days’ ) ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘tribe_events_cat’, ‘field’ => ‘slug’, ‘terms’ => ‘management-leadership’, ), ), ‘meta_query’ => array( array( ‘key’ => ‘associated_people’, ‘value’ => $current_user, ‘compare’ => … Read more

Assistance with elseif [closed]

Okay. I figured out how to do this. I assigned a variable to use the value of the custom meta field, which just made things a little easier to visualise (for me): <?php $intro_para_value = get_post_meta(get_the_ID(), ‘intro-para’, true ); if ( has_post_thumbnail() ) { print get_the_post_thumbnail(get_the_ID(), ‘homefeature_thumb’); } elseif ( !empty ($intro_para_value)) { echo $intro_para_value; … Read more

Simple php in wordpress widget [closed]

add_action( ‘wp_dashboard_setup’, ‘register_my_dashboard_widget’ ); function register_my_dashboard_widget() { wp_add_dashboard_widget( ‘net_profit_widget’, ‘Net Profit Calculator’, ‘net_profit_widget_display’ ); } function net_profit_widget_display() { $subPrice = 0; $subnumb = 0; if (array_key_exists(‘subprice’, $_POST) !== false) { $subPrice = $_POST[‘subprice’]; } if (array_key_exists(‘subnumb’, $_POST) !== false) { $subnumb = $_POST[‘subnumb’]; } $payperc = “2.9”; $paystan = “0.3”; $netprof = “N/A”; $expense = … Read more