我正在尝试在安装了Wordpress的子目录中正确运行搜索,但是无法正常工作。我试图进行一些更改,但没有一个可以解决。
在我的主页(https://cambiasaldo.com)中是一个用ASP.NET MVC开发的网站
在子目录(https://cambiasaldo.com/gana-dinero-por-internet)中,我安装了Wordpress。
Wordpress常规调整:
WordPress地址(URL):https://cambiasaldo.com/gana-dinero-por-internet
站点地址(URL):https://cambiasaldo.com
web.config
<rule name="Omitir que-es-uphold" stopProcessing="true">
<match url="^que-es-uphold" />
<action type="Rewrite" url="index.php"/>
</rule>
<rule name="Omitir que-es-skrill" stopProcessing="true">
<match url="^que-es-skrill" />
<action type="Rewrite" url="index.php"/>
</rule>
<rule >
...
</rule>
wp-content \ themes \ orbital \ search.php
<?php
/**
* The template for displaying search query
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package WordPress
* @subpackage Orbital
* @since 1.0
*/
get_header(); ?>
<main id="content" class="site-main">
<?php if ( have_posts() ) : ?>
<?php get_template_part( 'template-parts/header/header', 'default' ); ?>
<div class="container">
<div class="flex flex-fluid">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/loops/loop', 'grid' );
endwhile;
?>
</div>
<?php orbital_pagination(); ?>
</div>
<?php else : get_template_part( 'template-parts/none/content', 'none' );
endif; ?>
</main>
<?php get_footer();
wp-content \ themes \ orbital \ searchform.php
<?php
/**
* The template for displaying search form
*
* @link https://developer.wordpress.org/themes/basics/template-files/#using-template-files
*
* @package WordPress
* @subpackage Orbital
* @since 1.0
*/
?>
<form role="search" method="get" class="search-form" action="<?php echo site_url( '/' ); ?>">
<div class="search-input">
<input type="search" class="search-field" placeholder="<?php esc_html_e( 'Search for:', 'orbital' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php esc_html_e( 'Search for:', 'orbital' ) ?>" />
</div>
<div class="search-submit">
<button type="submit" class="btn btn-primary btn-search-form"><i class="fa fa-search"></i></button>
</div>
</form>
wp-includes \ general-template.php
/**
* Display 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.
*
* @since 2.7.0
*
* @param bool $echo Default to echo and not return the form.
* @return string|void String when $echo is false.
*/
function get_search_form( $echo = true ) {
/**
* Fires before the search form is retrieved, at the start of get_search_form().
*
* @since 2.7.0 as 'get_search_form' action.
* @since 3.6.0
*
* @link https://core.trac.wordpress.org/ticket/19321
*/
do_action( 'pre_get_search_form' );
$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
/**
* Filters the HTML format of the search form.
*
* @since 3.6.0
*
* @param string $format The type of markup to use in the search form.
* Accepts 'html5', 'xhtml'.
*/
$format = apply_filters( 'search_form_format', $format );
$search_form_template = locate_template( 'searchform.php' );
if ( '' != $search_form_template ) {
ob_start();
require( $search_form_template );
$form = ob_get_clean();
} else {
if ( 'html5' == $format ) {
$form = '<form role="search" method="get" class="search-form" action="' . esc_url( site_url( '/' ) ) . '">
<label>
<span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
<input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" />
</label>
<input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" />
</form>';
} else {
$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( site_url( '/' ) ) . '">
<div>
<label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" />
</div>
</form>';
}
}
/**
* Filters the HTML output of the search form.
*
* @since 2.7.0
*
* @param string $form The search form HTML output.
*/
$result = apply_filters( 'get_search_form', $form );
if ( null === $result ) {
$result = $form;
}
if ( $echo ) {
echo $result;
} else {
return $result;
}
}
该页面当前正在处理该问题。 我希望你能帮助我。 谢谢和问候。