How to add schema markup to WordPress menu function

To get that kind of control you will probably need to create a custom Walker. Take a look at the defaults for wp_nav_menu() $defaults = array( ‘theme_location’ => ”, ‘menu’ => ”, ‘container’ => ‘div’, ‘container_class’ => ”, ‘container_id’ => ”, ‘menu_class’ => ‘menu’, ‘menu_id’ => ”, ‘echo’ => true, ‘fallback_cb’ => ‘wp_page_menu’, ‘before’ => … Read more

Image rotation issue (horizontal picture uploading as vertical) — Exif issue?

summersummer solved the problem reported by installing the Image Rotation Repair, which describes itself as follows: The Image Rotation Repair plugin simply fixes image orientation based on EXIF data. This is primarily a patch for mis-oriented images delivered from iPhones. Functionally it filters all uploads and if EXIF->Orientation is set to a number greater than … Read more

Change WooCommerce add_to_cart Button Text?

It’s not working because: get_the_terms( $post->ID, ‘product_cat’ ) yields an array of objects, to test against those objects you have to run a loop and pull a $term_id property out of each object. WordPress to the rescue! WordPress has a helper method for that… has_term(330,’product_cat’, $post); Use the has_term method to satisfy your conditional.

Template code to split a post and print a custom field?

I’d suggest doing it this way to avoid running into problems where you split within a sentence/paragraph. Try splitting on <p> – then put the first element (first paragraph) into <div class=”content-first-half”> and the rest (if any) into <div class=”content-second-half”> in your template. It should be something like this (assuming $content has the html for … Read more

Add loggedout class on body using a function or JS

Presumably your theme is using the body_class function to output classes. You can add a filter to remove or add your own classes. function wpd_logged_out_body_class( $classes ) { if( ! is_user_logged_in() ){ $classes[] = ‘loggedout’; } return $classes; } add_filter( ‘body_class’, ‘wpd_logged_out_body_class’ );

Overwriting a plugin function

Unless the plugin itself provides hooks that you can use, or has been written is such a way as to be replaceable (a dicey proposition for a plugin), you can’t. This isn’t a WordPress restriction. It is a PHP one. You cannot “overload” or redefine functions in PHP. You will get a fatal error.