Custom Taxonomy Breaks Pages
Create file called taxonomy-industry.php and copy your archive.php into it. I faced the same proplem with my site and that solution worked for me. Hope it works for you
Create file called taxonomy-industry.php and copy your archive.php into it. I faced the same proplem with my site and that solution worked for me. Hope it works for you
You have two issues here. The use of $image->ID in this line wp_get_attachment_image($image->ID, ‘video-thumb’); This will give you the following error: NOTICE Error: [8] Undefined variable: image In all honesty, I think that should actually be $post->ID get_permalink() returns the permalink to the current post, which in this case is the image. If you want … Read more
here is the full code to force change theme by a reserved wordpress parameter add_action( ‘pre_get_posts’, ‘my_pre_get_posts’ ); function my_pre_get_posts($wp_query) { global $wpdb; // Confirm request is main query if(!$wp_query->is_main_query()) { return; } // Get post name from query $post_name = $wp_query->get(‘pagename’); // Get post type from database $post_type = $wpdb->get_var( $wpdb->prepare( ‘SELECT post_type FROM … Read more
You should need to do any custom querying on taxonomy-subject.php, just use the normal loop api. WordPress will build a query for you. As for your question: $args = array( ‘post_type’ => ‘documents’, ‘posts_per_page’ => 20, ); WP_Query doesn’t take a second argument to its constructor. All its seeing is the arguments above. You’re asking … Read more
I can tell how to do it with WordPress functions, which is quite easy and you won’t lose any important stuff: Upload the default.jpg image using WordPress media manager. Note the ID of the image. Get all posts from your custom post type and run set_post_thumbnail() for each one. Example: add this code to functions.php … Read more
The Codex includes a useful page on AJAX in plugins which outlines how to send and receive an ajax request. The code below covers how you would trigger an event when the select field is changed and fire off the ajax request. Make sure you’re getting and setting a nonce value. /** * Only execute … Read more
While your example of is_search() is a rather trivial one and harder to justify, it’s generally recommended in OOP styles to use getters and setters for things like this instead of public properties, for a number of reasons. Encapsulation. The behavior of is_search() returns a boolean, but the method by which it determines whether or … Read more
The quick and simple method might be to create a custom page template and have the search form send the user to the page that you create with it. <?php /* Template Name: Location Results */ if ( isset($_REQUEST[‘search_field_name’]) && !empty($_REQUEST[‘search_field_name’]) ) { # Read and escape the input data # Do your query, grab … Read more
Does this work? global $post; // make sure the post object is available $slug = $post->post_name; // get the slug // insert the slug into your query $args = array( ‘post_type’ => ‘client_prop’, ‘posts_per_page’ => 10, ‘tax_query’ => array( array( ‘taxonomy’ => ‘prop_neighborhood’, ‘field’ => ‘slug’, ‘terms’ => $slug, ) ) );
Try: <?php if ( $the_query->have_posts() ) :?> <?php echo ‘<h3>’ . date(‘l, F jS’) . ‘</h3>’; ?> <?php while ( $the_query->have_posts() ) : ?> // etc.