SILENT KILLERPanel

Current Path: > home > transcarter > > www > wp-content > themes > bridge > includes


Operation   : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Software     : Apache
Server IP    : 198.54.126.42 | Your IP: 216.73.216.135
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/transcarter//www/wp-content/themes/bridge/includes

NameTypeSizeLast ModifiedActions
comment Directory - -
font_awesome Directory - -
nav_menu Directory - -
pagination Directory - -
plugins Directory - -
sidebar Directory - -
qode-blog-helper-functions.php File 7730 bytes March 10 2023 20:42:12.
qode-breadcrumbs.php File 6819 bytes March 10 2023 20:42:12.
qode-custom-taxonomy-field.php File 20764 bytes March 10 2023 20:42:12.
qode-dynamic-helper-functions.php File 618547 bytes March 10 2023 20:42:12.
qode-fallback-helper-functions.php File 4263 bytes March 10 2023 20:42:12.
qode-gradient-helper-functions.php File 1581 bytes March 10 2023 20:42:12.
qode-loading-spinners.php File 5137 bytes March 10 2023 20:42:12.
qode-plugin-helper-functions.php File 95310 bytes March 10 2023 20:42:12.
qode-related-posts.php File 3405 bytes March 10 2023 20:42:12.

Reading File: /home/transcarter//www/wp-content/themes/bridge/includes/qode-related-posts.php

<?php

if ( ! function_exists('bridge_qode_get_related_post_type')) {
	/**
	 * Function for returning latest posts types
	 *
	 * @param $post_id
	 * @param array $options
	 * @return WP_Query
	 */
	function bridge_qode_get_related_post_type($post_id, $options = array()) {

		$post_type = get_post_type($post_id);
		//Get tags
		$tags = ($post_type == 'portfolio_page') ? wp_get_object_terms($post_id, 'portfolio_tag') : get_the_tags($post_id);
		//Get categories
		$categories = ($post_type == 'portfolio_page') ? wp_get_object_terms($post_id, 'portfolio_category') : get_the_category($post_id);

		$tag_ids = array();
		if ($tags) {
			foreach ($tags as $tag) {
				$tag_ids[] = $tag->term_id;
			}
		}

		$category_ids = array();
		if ($categories) {
			foreach ($categories as $category) {
				$category_ids[] = $category->term_id;
			}
		}

		$hasRelatedByTag = false;
		$hasRelatedByCategory = false;

		if ($tag_ids) {

			if ($post_type == 'portfolio_page') {
				$related_by_tag = bridge_qode_get_related_custom_post_type_by_param($post_id, $tag_ids, 'portfolio_tag', $options); //For Custom Posts
			} else {
				$related_by_tag = bridge_qode_get_related_posts($post_id, $tag_ids, 'tag', $options);
			}

			if (!empty($related_by_tag->posts)) {
				$hasRelatedByTag = true;
				return $related_by_tag;
			}
			$hasRelatedByTag = false;

		}
		if ($categories && !$hasRelatedByTag) {

			if ($post_type == 'portfolio_page') {
				$related_by_category = bridge_qode_get_related_custom_post_type_by_param($post_id, $category_ids, 'portfolio_category', $options);
			} else {
				$related_by_category = bridge_qode_get_related_posts($post_id, $category_ids, 'category', $options);
			}

			if (!empty($related_by_category->posts)) {
				$hasRelatedByCategory = true;
				return $related_by_category;
			}
			$hasRelatedByCategory = false;

		}

	}

}

if ( ! function_exists('bridge_qode_get_related_posts') ) {
	/**
	 * Function for related posts
	 *
	 * @param $post_id - Post ID
	 * @param $term_ids - Category or Tag IDs
	 * @param $slug - term slug for WP_Query
	 * @param array $options
	 * @return WP_Query
	 */
	function bridge_qode_get_related_posts($post_id, $term_ids, $slug, $options = array()) {

		//Query options
		$posts_per_page = -1;

		//Override query options
		extract($options);

		$args = array(
			'post__not_in'  => array($post_id),
			$slug . '__in'  => $term_ids,
			'order'         => 'DESC',
			'orderby'       => 'date',
			'posts_per_page'	=> $posts_per_page
		);

		$related_posts = new WP_Query($args);

		return $related_posts;

	}
}

if ( ! function_exists('bridge_qode_get_related_custom_post_type_by_param') ) {
	/**
	 * @param $post_id - Post ID
	 * @param $term_ids - Category or Tag IDs
	 * @param $taxonomy
	 * @param array $options
	 * @return WP_Query
	 */
	function bridge_qode_get_related_custom_post_type_by_param($post_id, $term_ids, $taxonomy, $options = array()) {

		//Query options
		$posts_per_page = -1;

		//Override query options
		extract($options);

		$args = array(
			'post__not_in'  => array($post_id),
			'order'         => 'DESC',
			'orderby'       => 'date',
			'posts_per_page'	=> $posts_per_page,
			'tax_query'     => array(
				array(
					'taxonomy'  => $taxonomy,
					'field'     => 'term_id',
					'terms'     => $term_ids,
				),
			)
		);

		$related_by_taxonomy = new WP_Query($args);

		return $related_by_taxonomy;

	}

}

SILENT KILLER Tool