2017-12-20 5 views
0

내 맞춤 게시 유형에 대한 검색 양식을 만들었으므로 내 사이트의 어느 곳에 나 배치 할 수 있기 때문에 단축 코드를 만들었습니다. 바닐라 양식은 잘 작동하지만 짧은 코드에서는 중복 된 필드가 표시됩니다. 왜 이런 일을 할 수 있는지 누가 알 수 있습니까? 상위 3 개 필드는 하위 양식의 필드와 중복됩니다. http://autismva.teebark.com/resource-finder-3에서 그 결과를 볼 수 있습니다.양식의 단축 코드가 중복 입력 필드를 표시합니다.

당신은 내가이 당신을 위해 작동 희망 http://autismva.teebark.com/resource-finder2

function resource_search_form($form) { 
$form = '<form id="category-select" class="category-select" method="post" action="' . esc_url(admin_url('admin-post.php')) . '" >' . 
    wp_dropdown_categories('show_count=1&hierarchical=1&depth=2&show_option_none=Select by category&name=$cat_id&taxonomy=resource_cat') . '<br>' . 
    wp_dropdown_categories('show_count=0&hierarchical=1&depth=1&show_option_none=Select by age&name=$age_id&taxonomy=resource_age') . '<br>' . 
    wp_dropdown_categories('show_count=0&exclude=128&show_option_none=Select by region&name=$region_id&taxonomy=resource_region') . '<br>' . 
    '<input type="text" name="s" placeholder="Search by keyword" /><br> 
    <input type="text" name="tag_name" placeholder="Search by tag" /> 
    <input type="hidden" name="action" value="resource_search_cat2" /> 
    <button type="submit" > Search </button> 
</form>'; 
return $form; 
} 

add_shortcode('resource_search', 'resource_search_form'); 

**The vanilla form:** 
<form id="category-select" class="category-select" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" > 
    <?php wp_dropdown_categories('show_count=1&hierarchical=1&depth=2&show_option_none=Select by category&name=$cat_id&taxonomy=resource_cat'); ?><br> 
    <?php wp_dropdown_categories('show_count=0&hierarchical=1&depth=1&show_option_none=Select by age&name=$age_id&taxonomy=resource_age'); ?><br> 
    <?php wp_dropdown_categories('show_count=0&exclude=128&show_option_none=Select by region&name=$region_id&taxonomy=resource_region'); ?><br> 
    <input type="text" name="s" placeholder="Search by keyword" /><br> 
    <input type="text" name="tag_name" placeholder="Search by tag" /> 
    <input type="hidden" name="action" value="resource_search_cat2" /> 
    <button type="submit" > Search </button> 
</form> 
+0

에서이 작업을 작성합니다. 함수가 출력을 반환하고 표시하지 않도록하려고합니다. – jh1711

+0

완벽한 - 감사합니다. – teebark

답변

0

에 바닐라 양식을 볼 수 있습니다. 당신이 단축 코드 내에서 사용할 때 wp_dropdown_categories``에`에코 = FALSE '를 통과해야 AFAIK // 당신의 "after_setup_theme"후크

add_action(' woocommerce_single_product_summary ' , ' your_function_name ' , 10); 

//define your function that contains the removal action hook. 
function your_function_name() 
{ 
    remove_action(' woocommerce_single_product_summary ' , ' woocommerce_template_single_add_to_cart ' , 30); 
} 
관련 문제