badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Changing seach behaviour in \inc\structure\searchform-extension.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #24119
    pavlo.golub
    Participant

    Hello.

    First of all thanks a lot for excellent product, I’m looking forward for Pro purchase after testing it a while.

    I’m using AWPCP plugin which adds classifieds support and I wish search form use AWPCP’s search engine instead of WP’s standard. Thus I may change interface\inc\structure\searchform-extension.php in such way:

    <?php
    require_once( ABSPATH . 'wp-content/plugins/another-wordpress-classifieds-plugin/includes/functions/routes.php' );
    
    add_action( 'interface_searchform', 'interface_display_searchform', 10 );
    /**
     * Displaying the search form.
     *
     */
    
    function interface_display_searchform() {
    ?>
    
    <form action="<?php echo awpcp_get_page_url( 'search-ads-page-name', true ); ?>" method="get" class="searchform clearfix">
      <label class="assistive-text">
        <?php _e( 'Search', 'interface' ); ?>
      </label>
      <input type="hidden" name="a" value="dosearch">
      <input type="search" placeholder="<?php esc_attr_e( 'Search', 'interface' ); ?>" class="s field" name="keywordphrase">
      <input type="submit" value="<?php esc_attr_e( 'Search', 'interface' ); ?>" class="search-submit">
    </form>
    <!-- .search-form -->
    <?php
    }
    ?>

    However I do not want to change the core files so I’ve created a child theme. But this functionality is not accessible since WP supports inheritance only for plugin root folder.

    The question: in what manner should I fix this issue?
    And in what file should I add my own widgets instead of \inc\widgets\interface_widgets.php which is not inherited for the same reasons?

    One more notice, your i18n file for Russian contains one tiny error, seems caused by auto translation:
    “Mail US” stands for “Напишите нам” in Russian, however translation is “Почта США” means “Mail of USA”.

    Any ideas when Ukrainian translation may be available?

    Thanks in advance!

    #24163

    Hi pavlo.golub,

    We cannot gurantee any other third party plugins will work in our theme or not. We have not tested AWPCP plugin in our theme. We don’t have Ukrainian translation in our theme.

    Here is a simple example how to unhook page 404.php
    Example to unhook the page 404:

    unhook functions

    
    // Unhook default Thematic functions
    function unhook_thematic_functions() {
        // Don't forget the position number if the original function has one
    
    remove_action( 'interface_404_content', 'interface_display_404_page_content', 10 );
    
    }
    add_action('init','unhook_thematic_functions'); // removes the header content by using hook interface_header
    
    add_action( 'interface_404_content', 'interface_child_display_404_page_content', 10 );
    /**
     * function to show the footer info, copyright information
     */
     
     
    function interface_child_display_404_page_content() {      ?>   
    <div id="content">
    		<header class="entry-header">
    			<h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'interface' ); ?></h1>
    		</header>
    		<div class="entry-content clearfix" >
    			<p>Thank you</p> 
    		</div><!-- .entry-content -->
    	</div><!-- #content -->
      <?php 
    }

    You may also search in forum how to unhook the parent code.
    For example:-

    https://www.themehorse.com/support-forum/topic/child-theme-404-page-and-search-page-styling/

    If you are still unable then you may hire a developer to fix it.

    You need to create a two file in your child theme
    style.css and functions.php (the above code should be added inside the functions.php)

    Thank you!

    #24178
    pavlo.golub
    Participant

    Hello, I don’t what guarantees for 3rd party plugins, I was just curious how to achieve additional functionality.

    Thanks it was clear enough, I managed thid way:

    
    <?php 
    //child theme functions.php 
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
    }
    
    add_action( 'interface_init', 'pg_interface_load_files', 20 );
    function pg_interface_load_files() {
        require_once( get_stylesheet_directory() . '/inc/structure/searchform-extensions.php' );
        require_once( get_stylesheet_directory() . '/inc/widgets/interface_widgets.php' );
    }
    #24203

    Hi pavlo.golub,

    <?php 
    //child theme functions.php 
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
    }

    This is the correct way. If there is a function hook then you have to unhook the functions first and then hook the functions in child theme and then customize the code.

    Thank You!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.