Template file renders on local install, not on web
Never mind. Appears to be a PEBCAK situation
Never mind. Appears to be a PEBCAK situation
Change your $args array a little bit: $args = array( ‘post_type’ => array( ‘my_projects’ ), // it need to get the posts from this post_type ‘order’ => ‘DESC’, ‘posts_per_page’ => 5, ‘project_tags’ => $term // search taxonomy ); Other ways to search for taxonomy terms can be found here in the WordPress Codex pages. Answer … Read more
when you register a taxonomy, the second argument is the post type it is available for: register_taxonomy( $taxonomy, $object_type, $args ); if you want the taxonomy to work for a custom type as well as standard posts, you can pass an array of types: $object_type = array( ‘your_custom_type’, ‘post’ ); alternately, you can use register_taxonomy_for_object_type: … Read more
In your functions.php function show_all_thumbs() { global $post; $post = get_post($post); $images =& get_children( ‘post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent=”.$post->post_parent); if($images) { foreach( $images as $imageID => $imagePost ){ unset($the_b_img); $the_b_img = wp_get_attachment_image($imageID, “thumbnail’, false); $thumblist .= ‘<a href=”‘.get_attachment_link($imageID).'”>’.$the_b_img.'</a>’; } } return $thumblist; } In your page template file: $loop = new WP_Query( array( ‘post_type’ => ‘demo’, // or whatever … Read more
You should save the ID of the first post in a variable (e.g $splash_post_id) and in the next loop, use “post__not_in” => $splash_post_id , in the $args array. $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘1’, ‘order_by’ => ‘date’, ‘order’ => ‘DESC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘theme’, ‘field’ => ‘slug’, ‘terms’ => … Read more
I can’t see any practical reason to use a custom taxonomy here. You can already query posts by year using OOB query and archive stuff (see this Codex article about the “year” WP_Query parameter, and this one about the “yearly” mode for wp_get_archives()). If you’re asking purely about performance, I’d consider this kind of thing … Read more
What is stores_47 exactly? A variable name? Shouldn’t it be $stores_47 instead? I don’t understand what you want to do here, but I think you’re looking for variable variables. Try this: <?php $cat_id = 47; $value = get_field(‘extended_store_descriptions’, ${ ‘stores_’ . $cat_id } ); echo $value;
You can make a loop to retrieve the taxonomies: foreach( array(‘genre’, ‘rating’, ‘year’) as $taxo ){ #loop over each taxonomy $terms = get_the_terms( $post->ID , $taxo ); if( $terms && ! is_wp_error( $terms ) ){ echo $taxo . ‘: ‘; $myterm = array(); #get list of term names foreach($terms as $term){ $myterm[] = $term->name; } … Read more
First thing’s first, correctly indent your code. Your editor/IDE should have auto-magical auto-indenting tools. Use them, they’re there for a reason, they’re not just some developers high and mighty opinions of beautiful code. Moving on, Instead of echoing them out, put them in arrays then after the loop do your echo’ing out of each e.g. … Read more
Yev, without a code sample to work from I’m not sure how helpful I can be but I’ll give you the code that I use for creating Custom Post Types with a archive page. This example will get you started for an FAQ (easily modified). Note the rewrite lines and the flush, which is what … Read more