`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

Advanced Custom Fields [closed]

OK, after playing for a while, I solved my issue with the following code: <?php $field = get_field(‘introduction’); if(!empty ($field)){ ?> <div class=”sc-project-type”> <h4>Introduction:</h4> <?php echo ($field); ?> </div> <?php } ?>

PHP- Why is my contact form keep showing it is invalid? [closed]

You should remove the <meta http-equiv=\”refresh\” content=\”0;URL=contactus.php\”> from your document head section, first. The problem Each time you press submit button on your form, you call chkContact where you do an ajax call. You should put an if before the ajax, so that it would not get executed if the form is invalid. if( form … Read more

How to get property out of image object

because you have two array the second array is nested within the first you must get the image url from the sizes array not from first array directly $overlayImage = $tempLargeImage[“sizes”][“thumbnail”];