我是一个新手,正在努力学习。
我从themeforest购买了一个高级主题,没有检查各个页面的功能。尝试了他们的支持,但没有提供任何解决方案。
现在我对代码了解很少。仍在努力学习。
有人能帮我一下吗:
1-我已经确定了三个(下面的代码)php文件可能能够解决这个问题,我相信第一个是最相关的。
2-由于我是新来的,有人能指出要编辑的正确字段吗?需要更改的是“(get\\u post\\u type()====”job\\u listing“)吗?
谢谢
searchform。php
<form class="search-form" method="get" action="<?php echo esc_url( home_url( \'/\' ) );
?>" role="search">
<?php if ( get_post_type() === \'job_listing\' ) {
echo \'<input type="hidden" name="post_type" value="job_listing" />\';
} ?>
<input class="search-field" type="text" name="s" id="s" placeholder="<?php esc_html_e
( \'What are you looking for?\', \'listable\' ); ?>" autocomplete="off"
value="<?php the_search_query(); ?>"/>
<button class="search-submit" name="submit" id="searchsubmit"></button>
搜索php:
<?php
/**
* Search results archive
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Listable
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<header class="page-header">
<h1 class="page-title"><?php printf( esc_html__( \'Search results for: %s\', \'listable\' ), \'<span>\' . get_search_query() . \'</span>\' ); ?></h1>
</header>
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<div class="postcards">
<div class="grid">
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="grid__item postcard">
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( \'template-parts/content\', get_post_format() );
?>
</div>
<?php endwhile; ?>
</div>
<?php the_posts_navigation(); ?>
</div>
<?php else : ?>
<?php get_template_part( \'template-parts/content\', \'none\' ); ?>
<?php endif; ?>
</main><!-- #main -->
search-job\\u列表。php
<?php
/**
* Search only listings results archive
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Listable
*/
get_header(); ?>
<div id="primary" class="content-area">
<div class="entry-content">
<main id="main" class="site-main" role="main">
<?php
global $current_jobs_shortcode;
$shortcode = \'[jobs keywords="\'. get_search_query() .\'" show_filters="true"\';
//get the listings page (Selected in the WPJM settings) job shortcode show_map parameter
//we will apply it here also
$show_map = listable_listings_page_shortcode_get_show_map_param();
if ( false === $show_map ) {
$shortcode .= \' show_map="false"\';
} else {
$shortcode .= \' show_map="true"\';
}
//get the listings page (Selected in the WPJM settings) job shortcode orderby parameter
//we will apply it here also
$orderby = listable_listings_page_shortcode_get_orderby_param();
$shortcode .= \' orderby="\' . $orderby . \'"\';
//get the listings page (Selected in the WPJM settings) job shortcode order parameter
//we will apply it here also
$order = listable_listings_page_shortcode_get_order_param();
$shortcode .= \' order="\' . $order . \'"\';
$shortcode .= \']\';
//save the shortcode so we can use it later to look at it\'s parameters in filters
//this is because WPJM doesn\'t pass the parameters in some filters
$current_jobs_shortcode = $shortcode;
echo do_shortcode( $shortcode );
$current_jobs_shortcode = null;
?>
</main><!-- #main -->
</div>
</div><!-- #primary -->
<?php
get_sidebar();
get_footer(); ?>