WP Job Manager:创建自定义工作搜索表单 [英] WP Job Manager: Creating a custom job search form

查看:33
本文介绍了WP Job Manager:创建自定义工作搜索表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 WP 作业管理器插件在我的主页上有一个搜索字段.

从功能的角度来看,它应该像在 AirBnB 上一样,但没有签入/签出/来宾选项,而是一个简单的搜索字段,一些像这样的复选框

我还没有设计它.

要使其正常工作,您需要更改示例代码中的这一行以显示您的主要工作页面所在的网址:

对我来说是:

当您设置 WP Job Manager 时,它会要求您选择一个页面,您将在其中显示工作 - 然后将相关短代码添加到该页面,该页面将显示您的所有工作.

此页面是您需要在该行代码中添加的页面.我选择的页面被称为 all-jobs 并出现在我的 URL 末尾,如下所示:http://www.synergy-personnel-services/all-jobs/

我相信您当然可以将完整的 URL 放在那里,但只添加以 ../开头的页面名称可确保如果您更改域,链接仍然有效

I am trying to have a search field on my homepage with the WP Job Manager Plugin.

from the functionality point of view it should be like on AirBnB but without the checkin/checkout/guest option and instead a simple search field some check boxes like this

and there should be a "Search" button which would than link to the page where the search results are presented.

There is a tutorial (https://wpjobmanager.com/document/tutorial-creating-custom-job-search-form/, but I do not Understand it.

Would appreciate any answer!

The following code is my "job-filters.php"-file, where I edited the search field.

<?php wp_enqueue_script( 'wp-job-manager-ajax-filters' ); ?>

<?php do_action( 'job_manager_job_filters_before', $atts ); ?>

<form class="job_filters">
	<?php do_action( 'job_manager_job_filters_start', $atts ); ?>

	<div class="search_jobs">
		<?php do_action( 'job_manager_job_filters_search_jobs_start', $atts ); ?>

		<div class="search_keywords">
			<label for="search_keywords"><?php _e( 'Search', 'wp-job-manager' ); ?></label>
			<input type="text" name="search_keywords" id="search_keywords" placeholder="<?php esc_attr_e( 'Search', 'wp-job-manager' ); ?>" value="<?php echo esc_attr( $keywords ); ?>" />
		</div>



		<?php if ( $categories ) : ?>
			<?php foreach ( $categories as $category ) : ?>
				<input type="hidden" name="search_categories[]" value="<?php echo sanitize_title( $category ); ?>" />
			<?php endforeach; ?>
		<?php elseif ( $show_categories && ! is_tax( 'job_listing_category' ) && get_terms( 'job_listing_category' ) ) : ?>
			<div class="search_categories">
				<label for="search_categories"><?php _e( 'Category', 'wp-job-manager' ); ?></label>
				<?php if ( $show_category_multiselect ) : ?>
					<?php job_manager_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category, 'hide_empty' => false ) ); ?>
				<?php else : ?>
					<?php job_manager_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'show_option_all' => __( 'Any category', 'wp-job-manager' ), 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category, 'multiple' => false ) ); ?>
				<?php endif; ?>
			</div>
		<?php endif; ?>

		<?php do_action( 'job_manager_job_filters_search_jobs_end', $atts ); ?>
	</div>

	<?php do_action( 'job_manager_job_filters_end', $atts ); ?>
</form>

<?php do_action( 'job_manager_job_filters_after', $atts ); ?>

<noscript><?php _e( 'Your browser does not support JavaScript, or it is disabled. JavaScript must be enabled in order to view listings.', 'wp-job-manager' ); ?></noscript>

解决方案

I've just done this, you paste that code example where you would like the search boxes to appear.

For me, it was on my homepage in the hero banner. This sets up the form. like so:

I haven't styled it yet.

To get it working you need to change this line in the example code to show the url where your main jobs page is:

<form method="GET" action="YOUR_JOBS_PAGE_URL">

For me it was:

<form method="GET" action="../all-jobs">

When you set up WP Job Manager, it asks you to choose a page where you will display the jobs - then you add the relevant shortcode to that page and that page will display all of your jobs.

This page is the page you need to add inside that line of code. The page I chose was called all-jobs and appeared at the end of my URL like this: http://www.synergy-personnel-services/all-jobs/

I believe you can, of course, put the full URL in there, but adding just the name of the page preceded by the ../ ensures if you ever change the domain the link will still work

这篇关于WP Job Manager:创建自定义工作搜索表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆