Links Image in “Catalog” Page to Posts

In your function virtarich_katalog_function wrap the thumbnail with an <a> link tag like this: function virtarich_katalog_function() { global $post; $vtr_query = new WP_Query(‘showposts=10000’); while ($vtr_query->have_posts()) : $vtr_query->the_post(); ?> <div class=”col-md-3 ikibro”> <div class=”wpagen-produk”> <div class=”katalog-gambar-center”> <div class=”katalog-gambar”><a href=”https://wordpress.stackexchange.com/questions/260406/<?php the_permalink() ?>” title=”<?php the_title(); ?>”><?php virtarich_thumb_normal() ?></a></div> </div> <div class=”katalog-title”><?php the_title(); ?></div> <div class=”katalog-harga”>Rp <?php virtarich_harga(); ?><span … Read more

Add in the url attachment loop the wp_link_pages of the post

In order to get the parent post, you would use the wp_get_post_parent_id() function. So in your foreach loop, you would want to add something like: $parent = wp_get_post_parent_id( $attachment->ID ); <a href=”https://wordpress.stackexchange.com/questions/260459/<?php esc_url( the_permalink( $parent ) ) ?>”> // Rest of your HTML </a>

Show posts from last 3 years in posts page

You should adapt it to fit your needs, e.g. (not tested) : // Create a new filtering function that will add our where clause to the query function filter_where( $where=”” ) { $where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘-1 year’)) . “‘”; return $where; }<br> add_filter( ‘posts_where’, ‘filter_where’ ); $query = new … Read more

Show post excerpt

One option would be to use substr in your function: function my_excerpt($limit) { $excerpt = get_the_excerpt(); if(strlen($excerpt) > $limit) { // trim to $limit characters $excerpt = substr($excerpt, 0, $limit); // remove any truncated words $excerpt = substr($excerpt, 0, strippos($excerpt, ” “)); $excerpt = trim(preg_replace(‘/\s+/’, ‘ ‘, $excerpt)); } return $excerpt; } Another way is … Read more