Multiple Loops on a Page Without Duplicates

Is there a reason to execute the query in each individual div instead of looping the div within the query? <?php $my_query = new WP_Query( ‘post_type=portfolio&showposts=13’ ); while ( $my_query->have_posts() ) : $my_query->the_post(); ?> <div class=”port1″> <?php the_title(); ?> </div> <?php endwhile; ?> If you want to number the divs sequentially, you can use a … Read more

Accessing a protected property of a post

The foolproof method here to grab a dynamic member variable is to use reflection! Lets say we have this class: class MyClass { private $myProperty = true; } We can use reflection to acquire the class, and the property: $class = new ReflectionClass(“MyClass”); $property = $class->getProperty(“myProperty”); We can then set that property to accessible: $property->setAccessible(true); … Read more

Post Type Support Array Not Working

remove_post_type_support() doesn’t support arrays. You have to unregister each feature separately. See: https://codex.wordpress.org/Function_Reference/remove_post_type_support https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/post.php#L1746