Print last modified date only on posts

You can check the post type with get_post_type(). You only want to display the content if the value is post: function wpb_last_updated_date( $content ) { $u_time = get_the_time( ‘U’ ); $u_modified_time = get_the_modified_time( ‘U’ ); if ( get_post_type() === ‘post’ ) { if ( $u_modified_time >= $u_time + 86400) { $updated_date = get_the_modified_time( ‘F jS, … Read more

Replacing a plugin function with a custom renamed function doesn’t work

First, in the original wc_bookings_get_time_slots_html() function, the following line: $block_html .= ‘<div class=”please-select”>Hi please select your session</div>’; doesn’t exist, so that is confusing for people trying to get what is the difference between the original function, and the one you copied (renamed and customized) in your active theme’s function php file. Now copying a plugin … Read more

get author_name from queried post

The problem with your code lies in these three lines: $queried_post = get_post($post_id); $author_id = $queried_post->post_author; $first = $user_info->user_nicename; You correctly get authors ID, but then you try to get some field of user_info variable, which is not defined anywhere in your code. One way to fix it is to get user info (using get_userdata) … Read more