/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/template-parts/related-posts.php
<?php if( isset($args['post_type']) ):
$post_id = get_the_ID();
$post_type = $args['post_type'];
$related_title = get_field('related_title','page_'.$post_type) ? : 'Related posts'; ?>
<?php $arg = array(
'post_type' => $post_type,
'posts_per_page' => 3,
'post__not_in' => array($post_id),
);
if( taxonomy_exists('cat_'.$post_type) ):
$categories = wp_get_post_terms( $post_id, 'cat_'.$post_type);
$arg['tax_query'] = array('relation' => 'AND');
$arg["tax_query"][] = array(
'taxonomy' => 'cat_'.$post_type,
'field' => 'id',
'terms' => $categories[0]->term_id,
'operator' => 'IN'
);
endif;
$the_query = new WP_Query( $arg );
if ( $the_query->have_posts() ) : ?>
<section class="related-posts-section sec-margin-blocks">
<div class="container">
<div class="row">
<div class="col">
<div class="line-box titles-box decor-box">
<div class="titles-wrap nmp-last-el">
<h2 class="title"><?php echo esc_html($related_title); ?></h2>
</div>
</div>
</div>
</div>
</div>
<div class="posts-list-wrap">
<div class="container">
<div class="row">
<div class="col">
<div class="posts-list flex-box-parent posts-slider">
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php $args = array('post_type' => $post_type); ?>
Arguments
/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/template-parts/related-posts.php
<?php if( isset($args['post_type']) ):
$post_id = get_the_ID();
$post_type = $args['post_type'];
$related_title = get_field('related_title','page_'.$post_type) ? : 'Related posts'; ?>
<?php $arg = array(
'post_type' => $post_type,
'posts_per_page' => 3,
'post__not_in' => array($post_id),
);
if( taxonomy_exists('cat_'.$post_type) ):
$categories = wp_get_post_terms( $post_id, 'cat_'.$post_type);
$arg['tax_query'] = array('relation' => 'AND');
$arg["tax_query"][] = array(
'taxonomy' => 'cat_'.$post_type,
'field' => 'id',
'terms' => $categories[0]->term_id,
'operator' => 'IN'
);
endif;
$the_query = new WP_Query( $arg );
if ( $the_query->have_posts() ) : ?>
<section class="related-posts-section sec-margin-blocks">
<div class="container">
<div class="row">
<div class="col">
<div class="line-box titles-box decor-box">
<div class="titles-wrap nmp-last-el">
<h2 class="title"><?php echo esc_html($related_title); ?></h2>
</div>
</div>
</div>
</div>
</div>
<div class="posts-list-wrap">
<div class="container">
<div class="row">
<div class="col">
<div class="posts-list flex-box-parent posts-slider">
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php $args = array('post_type' => $post_type); ?>
Arguments
2
"Undefined array key 0"
"/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/template-parts/related-posts.php"
16
/nas/content/live/vanesgroupnew/wp-includes/template.php
if ( isset( $s ) ) {
$s = esc_attr( $s );
}
/**
* Fires before a template file is loaded.
*
* @since 6.1.0
*
* @param string $_template_file The full path to the template file.
* @param bool $load_once Whether to require_once or require.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'wp_before_load_template', $_template_file, $load_once, $args );
if ( $load_once ) {
require_once $_template_file;
} else {
require $_template_file;
}
/**
* Fires after a template file is loaded.
*
* @since 6.1.0
*
* @param string $_template_file The full path to the template file.
* @param bool $load_once Whether to require_once or require.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'wp_after_load_template', $_template_file, $load_once, $args );
}
Arguments
"/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/template-parts/related-posts.php"
/nas/content/live/vanesgroupnew/wp-includes/template.php
$located = '';
foreach ( (array) $template_names as $template_name ) {
if ( ! $template_name ) {
continue;
}
if ( file_exists( $stylesheet_path . '/' . $template_name ) ) {
$located = $stylesheet_path . '/' . $template_name;
break;
} elseif ( $is_child_theme && file_exists( $template_path . '/' . $template_name ) ) {
$located = $template_path . '/' . $template_name;
break;
} elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
$located = ABSPATH . WPINC . '/theme-compat/' . $template_name;
break;
}
}
if ( $load && '' !== $located ) {
load_template( $located, $load_once, $args );
}
return $located;
}
/**
* Requires the template file with WordPress environment.
*
* The globals are set up for the template file to ensure that the WordPress
* environment is available from within the function. The query variables are
* also available.
*
* @since 1.5.0
* @since 5.5.0 The `$args` parameter was added.
*
* @global array $posts
* @global WP_Post $post Global post object.
* @global bool $wp_did_header
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
Arguments
"/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/template-parts/related-posts.php"
false
array:1 [
"post_type" => "news"
]
/nas/content/live/vanesgroupnew/wp-includes/general-template.php
$templates[] = "{$slug}-{$name}.php";
}
$templates[] = "{$slug}.php";
/**
* Fires before an attempt is made to locate and load a template part.
*
* @since 5.2.0
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialized template or an empty
* string if there is none.
* @param string[] $templates Array of template files to search for, in order.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'get_template_part', $slug, $name, $templates, $args );
if ( ! locate_template( $templates, true, false, $args ) ) {
return false;
}
}
/**
* Displays search form.
*
* Will first attempt to locate the searchform.php file in either the child or
* the parent, then load it. If it doesn't exist, then the default search form
* will be displayed. The default search form is HTML, which will be displayed.
* There is a filter applied to the search form HTML in order to edit or replace
* it. The filter is {@see 'get_search_form'}.
*
* This function is primarily used by themes which want to hardcode the search
* form into the sidebar and also by the search widget in WordPress.
*
* There is also an action that is called whenever the function is run called,
* {@see 'pre_get_search_form'}. This can be useful for outputting JavaScript that the
* search relies on or various formatting that applies to the beginning of the
* search. To give a few examples of what it can be used for.
Arguments
array:1 [
0 => "template-parts/related-posts.php"
]
true
false
array:1 [
"post_type" => "news"
]
/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/single.php
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="container">
<div class="row justify-content-center">
<div class="col">
<div class="single-content-box">
<div class="single-content nmp-last-el"><?php the_content(); ?></div>
</div>
</div>
</div>
<?php $args = array('post_type' => $post_type); ?>
<?php get_template_part('template-parts/share-socials',null, $args); ?>
</div>
</section>
<?php $args = array('post_type' => $post_type); ?>
<?php get_template_part('template-parts/related-posts',null,$args); ?>
</main>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>
Arguments
"template-parts/related-posts"
""
array:1 [
"post_type" => "news"
]
/nas/content/live/vanesgroupnew/wp-includes/template-loader.php
}
break;
}
}
if ( ! $template ) {
$template = get_index_template();
}
/**
* Filters the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
Arguments
"/nas/content/live/vanesgroupnew/wp-content/themes/vanesgroup/single.php"
/nas/content/live/vanesgroupnew/wp-blog-header.php
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
Arguments
"/nas/content/live/vanesgroupnew/wp-includes/template-loader.php"
/nas/content/live/vanesgroupnew/index.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
Arguments
"/nas/content/live/vanesgroupnew/wp-blog-header.php"