Two posts in same div – WP loop

This is really just a matter of logic. You need to conditionally print the div markup. The counter in $wp_query will let you chose every second post. if (have_posts()) { echo ‘<div class=”posts-wrapped”>’; while (have_posts()) { the_post(); if (0 !== $wp_query->current_post && 0 === $wp_query->current_post%2 ) { echo $wp_query->current_post.'</div><div class=”posts-wrapped”>’; } the_title(); echo ‘<br />’; … Read more

Creating a WordPress shortcode

Separate out your logic from the string you want to return: <?php // Adding a shortcode to return each author’s social media links function funcauthor_social( $atts ){ $meta_socialgr = esc_url(get_post_meta( $post->ID, ‘author_goodreads’, true )); $output=”<div class=”authorsocial”><h5>Connect, Share &amp; Follow</h5><ul>”; if (!empty($meta_socialgr)) { $output .= ‘<li><a href=”‘.$meta_socialgr.'”><img src=”http://fiddlehead.milkbossindustries.com/files/goodreads.jpg”></a></li>’; } $output .= ‘</ul></div>’; return $output; } add_shortcode( … Read more

Edit format of Paginate_Links()

There is no clean way to do this (that I notice from quick look at rather messy code of it), but $n_display is passed though formatting number_format_i18n() function which does have a filter. So you could try something like: function make_number_into_dot( $number ) { return ‘o’; } add_filter( ‘number_format_i18n’, ‘make_number_into_dot’ ); // your pagination handling … Read more

How do I create comment-reply-button using element not

You can generate a custom comment reply element like so: This will replace the **** HERE <SPAN> ELEMENT FOR REPLY-BUTTON WILL BE PLACED ****. <?php if ( get_option( ‘comment_registration’ ) && ! is_user_logged_in() ) : ?> <a rel=”nofollow” class=”comment-reply-login” href=”https://wordpress.stackexchange.com/questions/321913/<?php // wrapped echo esc_url( wp_login_url( get_permalink() ) ); ?>”>Log in to Reply</a> <?php else : … Read more