WP Query to display events and custom post type in a set order

I have implemented the following code to my them to achieve the custom ordering for featured events (first), regular events (second), and notices (third). New additions to the code include: Merged the posts using array_merge like this: $merged_posts = array_merge( $featured_events->posts, $future_events->posts, $notices->posts ); Ran a foreach to set a custom post order for featured … Read more

No src and sizes attributes present on WordPress thumbnail images; the smallest image size is loaded irregardless of viewport size

WordPress Responsive Images Without Imagick No, you do not need Imagick to get WordPress responsive images (srcset and sizes) working. As of WordPress 4.4+, if your theme has post-thumbnails enabled and you are using core functions like the_post_thumbnail() or wp_get_attachment_image(), WordPress will automatically include srcset and sizes attributes (assuming multiple image sizes exist). The GD … Read more

get_avatar() Returning a Number

your code will pretty much produce errors like missing ; at the end this code for example <?php esc_url( the_author_meta( ‘user_url’ ) ) ?> the correct code should be <?php echo esc_url( get_the_author_meta( ‘user_url’ ) ); ?> or <?php the_author_meta( ‘user_url’ ); ?> Why does the author ID number appear? The number that appears above … Read more

Adding a new custom post type using the editor causes 502 bad gateway error

I did some further research and testing, and found the issue to be related to nginx and not WordPress itself. The following Stack Overflow post included some configuration adjustments for the site’s config file that resolved the 502 bad gateway issues. My configuration file’s client_max_body_size was already set to 64M. Here are the nginx settings … Read more

If necessary, how should wp_get_attachment_image() and its parameters be escaped?

TLDR: No parameters need to escaped. The below assumes no third-party code hooked into any filters run by the wp_get_attachment_image() function or sub-function calls: $attachment_id (parameter 1) This is used to get the attachment post and reference it in other functions. This parameter is not used in direct output and thus does not need to … Read more