Thumbnail & Category link aside post

They are actually doing this is one loop, here’s an example to show similar structure. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”article”> <div class=”left”> <?php the_post_thumbnail( $size, $attr ); ?> <?php get_the_category(); ?> </div><!– end left side –> <div class=”right”> <?php the_excerpt(); ?> </div> <!– end right … Read more

display random posts on index.php instead of latest

Place the following code in your theme functions.php file. function one_random_post_on_home_page( $query ) { if ( ! ( $query->is_home() && $query->is_main_query() ) ) return; $query->set( ‘orderby ‘, ‘rand’ ); $query->set( ‘posts_per_page’, 1 ); } add_action( ‘pre_get_posts’, ‘one_random_post_on_home_page’ ); I’m assuming when you say index.php you mean your blogs home page. The index.php file in your … Read more

Start post pagination at 0 instead of 1

The ../page/X structure ties to pagination, not to post names. I’m sure you could change them but I’m not sure how deep the effects of the change would be. Have you thought about an alternate solution? Name each post your chapter name Forward Chapter 1 Chapter 2 Add a plugin that adds previous / next … Read more

Filter only the text in the_content

Based on your comment clarifying what you want to achieve, it appears you want to display the first 60 characters of your post not including any shortcodes. To do this you can use the strip_shortcodes() function. Rewritten with that, your code will look like this: $content = strip_shortcodes(get_the_content()); $content = apply_filters(‘the_content’, substr($content, 0, 60) ); … Read more

Auto-realod with new posts // Ajax call

If what you want is is a full page refresh then you don’t need ajax at all and inserting the htt-equip html meta will do the trick <meta http-equiv=”refresh” content=”5″ > (content is time in seconds IIRC) You just hook on wp_head and insert it. function wpse_228671_wp_head() { echo ‘<meta http-equiv=”refresh” content=”5″ >’; } add_action(‘wp_head’,’wpse_228671_wp_head’);

Retrieve post ID from “querying” URL

Try This Code $latest = new WP_Query( array ( ‘post_type’ =>’your-post-type-name’, ‘post_status’ =>’publish’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 3 )); while ( $latest -> have_posts() ) : $latest -> the_post(); echo the_ID(); endwhile;

Overwrite posts/pages via import

A good way around this I’ve found is to modify your local wp-config.php to access the remote database directly. You often have to enable remote sql in CPANEL. Then you enter the remote host URL in the define(‘DB_HOST’, ‘yoursite.com’); part of the config.