File manager - Edit - /home/palg2351/public_html/sinergihub.id/wp-content/themes/landingpress-wp/related.php
Back
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly global $post; $post_id = ''; if (get_post_type() == 'post') $post_id = get_the_ID(); elseif (get_post_type() == 'attachment') $post_id = $post->post_parent; if (!$post_id) return; $related = landingpress_get_related_posts($post_id); if (empty($related)) return; $args = array( 'post__in' => $related, 'post__not_in' => array($post_id), 'posts_per_page' => 5, ); $the_query = new WP_Query($args); if ($the_query->have_posts()) : $related_layout = get_theme_mod('landingpress_related_layout'); if (!$related_layout) { $related_layout = 'thumb-right'; $related_layout = 'gallery-2cols'; } if (in_array($related_layout, array('thumb-left', 'thumb-right'))) { $related_image = 'thumbnail'; } elseif (in_array($related_layout, array('thumb-medium-left', 'thumb-medium-right', 'gallery-2cols', 'gallery-3cols'))) { $related_image = 'post-thumbnail-medium'; } else { $related_image = ''; } $class = 'blog-layout-' . $related_layout; if (in_array($related_layout, array('thumb-left', 'thumb-right', 'thumb-medium-left', 'thumb-medium-right'))) { $class .= ' clearfix'; } add_action('excerpt_length', 'landingpress_related_excerpt_length'); function landingpress_related_excerpt_length($length) { $excerpt_length = get_theme_mod('landingpress_related_excerpt_length', 55); $excerpt_length = intval($excerpt_length); if ($excerpt_length < 1) { $excerpt_length = 55; } return $excerpt_length; } ?> <div class="related-posts"> <h3><?php esc_html_e('Related Posts', 'landingpress-wp'); ?></h3> <ul class="clearfix"> <?php while ($the_query->have_posts()) : $the_query->the_post(); ?> <li class="<?php echo esc_attr($class); ?>"> <div class="blog-section-image"> <?php if ($related_image) echo landingpress_get_image(array('size' => $related_image, 'alt' => get_the_title(), 'link' => 'post', 'fallback' => 'attachment')); ?> </div> <div class="blog-section-content"> <?php the_title(sprintf('<h4><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h4>'); ?> <p><?php echo get_the_excerpt(); ?></p> </div> </li> <?php endwhile; ?> </ul> </div> <?php endif; ?> <?php /* Restore original Post Data */ wp_reset_postdata(); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 1.1 |
proxy
|
phpinfo
|
Settings