Single post comment template not working

I cant get the comments template to show up in my single-events.php This is my code <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( ‘content’, ‘events’ ); ?> <?php comments_template( ”, true ); ?> <?php endwhile; // end of the loop. ?> If I put the comments template in my events template (events.php), … Read more

Disable Single Post View for Specific Taxonomy on Custom Post Type

we have a somewhat unique problem with a specific Custom Post Type that was developed for a client. It basically boils down to a need to disable the single post view for any posts that have been assigned to a specific taxonomy in the CPT we created. EXAMPLE: Custom Post Type: ‘rentals’ Taxonomies: ‘apartment’, ‘condo’, … Read more

is_singular() not working if called via callback function of admin-ajax.php

In my single.php I’ve some code like this … if(is_singular(‘post’)) { echo ‘Blog’; } else { echo ‘CPT’; } If I approach single.php from blog or CPT index page by using the_permalink(), this condition works correctly. It show ‘Blog’ when I open single blog post and shows ‘CPT’ when I open single CPT. Now the … Read more

Get taxonomy name of current post

Hierarchical taxonomy of custom post type ‘projects’ > ‘projects_category’. Two example ‘projects_category’ hierarchies would be: Big Corporates > 1st Company Name > A Post Title Small Business > 2nd Company Name > Another Post Title I can get ‘1st Company Name’ with the following: <?php $terms = get_the_terms($post->ID, ‘projects_category’);foreach($terms as $term){echo $term->name;} ?> How can … Read more

single page wordpress

I like wordpress as a CMS and I think it’s got a lot there with it’s vast plugin library however the front end, dare I say it is a bit out of date. I don’t like the system of old going page-to-page and would prefer a single-page site powered by JSON/AJAX. I’ve used wordpress to … Read more

Custom SQL query to get List of posts with featured image url

I am working on a task where i need to retrive 100s posts under single-page/single-request with their featured images. By using wordpress method of retriving posts and then retrive featured image individually using get_the_post_thumbnail function it takes so much time to load the page. Can someone provide a faster solution for this like retrive posts … Read more

Listing a post’s categories and subcategories

Is there a way to display the parent categories and subcategories for a particular post (ie. for use on single.php). I’ve tried using get_the_category_list(), but it displays a list like this: Subcat1 ParentCat1 Subcat2 Subcat3 ParentCat2 Even if you try the ‘single’ or ‘multiple’ display argument, it doesn’t give me what I want, which is … Read more

Pre get posts for single post

I pre get posts for a events archive page: http://www.netzwerk-leipziger-freiheit.de/veranstaltungen/ function my_pre_get_posts( $query ) { // do not modify queries in the admin if( is_admin() ){ return $query; } // only modify queries for ‘event’ post type if( isset($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] == ‘events’ ) { $query->set(‘orderby’, ‘meta_value_num’); $query->set(‘meta_key’, ‘vdatum’); $query->set(‘order’, ‘ASC’); } // return return … Read more