WordPress Post Grid

This isn’t really a WordPress related question, and you can get your desired result by a simple PHP loop: $i = 1; foreach ($array as $var) { if ($i==7) { // six items already displayed. // Do whatever you want here // now restart the count $i = 1; } // display your thumbs or … Read more

Get first comment link on the post itself

you can get comment link by wp function $args = array( ‘number’ => ‘1’, ‘post_id’ => your_post_id, // use post_id, not post_ID ); $comments = get_comments($args); <a href=”https://wordpress.stackexchange.com/questions/108654/<?php echo get_comment_link( $comments->comment_ID ); ?>”>postname</a>

Get post id on click of thumbnail

You need ajax. The html: <div id=”PersonBio”></div> <div id=”mainTextTitle”></div> <div id=”mainText”> <ul class=”faces”> <?php $categories = get_categories(); foreach ( $categories as $category ) { $i = -1; echo ‘<div class=”grid-row”><h2>’ . $category->name . ‘</h2></div>’; $args = array( ‘posts_per_page’ => -1, ‘cat’ => $category->term_id ); $cat_posts = new WP_Query($args); if ( $cat_posts->have_posts() ) : while ( … Read more

Single post page from static home not working

See the change of get_permalink to the_permalink This might work for you. <?php $args = array( ‘numberposts’ => 5, ‘order’=> ‘ASC’, ‘orderby’ => ‘date’ ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div class=”single_post”> <h3><?php the_date(); ?></h3> <h3> <a href=”https://wordpress.stackexchange.com/questions/109174/<?php the_permalink();?>”> <?php the_title(); ?> </a> </h3> <?php the_excerpt(); ?> </div> … Read more

Howto put advertising as post number 1,2,3 etc

You can use this property of WP_Query: $current_post (available during The Loop) Index of the post currently being displayed. Let’s say you have your current version of loop: <?php while ( have_posts() ): the_post(); ?> … some code that is displaying current post <?php endwhile; ?> Change it to something like this: <?php while ( … Read more