Adding instant search to wordpress page

I finally figured this out. What ended up working is putting the script portion in a .js file within the theme directory, calling it using the functions.php in my child theme, and having the HTML input field and div tag in the body of the page. Hopefully this can spare others the same pain I … Read more

I want my wordpress loop to only display posts of the standard format

Use get_post_format() inside your loop: if (have_posts()) : while (have_posts()) : the_post(); $format = get_post_format(); if (false === $format) { get_template_part(‘content’, get_post_format()); } endwhile; twentyfourteen_paging_nav(); else : get_template_part(‘content’, ‘none’); endif;

How to redirect unattached image attachments

Posts that aren’t attached have no parent, and posts with no parent have a parent of 0. So this: if ( is_attachment() && isset( $post->post_parent ) && is_numeric( $post->post_parent ) && ( $post->post_parent != 0 ) ) { becomes this: if ( is_attachment() && ( $post->post_parent == 0 ) ) {

Remove all nav menu classes except those which begin with certain letters

array_intersect() is not a good choice when you need a partial match. Go through each class, and apply both checks before you remove a class. Example, not tested: function remove_menu_classes( $classes ) { // List of allowed menu classes $allowed = array ( ‘current-menu-item’, ‘current-menu-ancestor’, ‘menu-item-has-children’, ‘current-post-ancestor’, ‘first’, ‘last’, ‘vertical’, ‘horizontal’ ); if ( ! … Read more