post loop with different design depending on post

Your $count++ needs to be after your endif statement. It’s not counting up because your counter is always at 0 which means you’re always in your “if” portion of your statement not your “else”. Like this: $args = array( ‘post_type’ => ‘post’, ‘post_per_page’ => 3, ); <?php $loop = new WP_Query($args); $count = 0; while … Read more

How to make posts under custom post type not generate a URL / post

Looking at the class and function you’re using, this method is a little problematic: public function buildPostArgs( $slug, $singular=”Post”, $plural=”Posts”, $args = array() ) { $args = wp_parse_args($args, $this->postDefaults); $args[‘rewrite’][‘slug’] = $slug; $args[‘labels’] = $this->buildPostLabels($singular, $plural); return $args; } If we ignore your problem, $args[‘rewrite’][‘slug’] is going to generate a PHP warning if you set … Read more

IF taxonomy archive is hierarchical THEN

Look at the docs (please read the docs) for is_taxonomy_hierarchical(). You need to tell it which taxonomy you’re checking: if ( is_taxonomy_hierarchical( ‘my_taxonomy_name’ ) ) { } If you’re template isn’t specific to a taxonomy, and you need to know which taxonomy you’re viewing, use get_queried_object() to figure it out (you were already told how … Read more