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

tech