• Works fine but it loads with wp_head(); enabled.
    I need to load in wp_footer();
    especially the script wp-content/plugins/ajaxy-search-form/js/sf.js

    for style.css and common.css I added them manually to my <head>.

    _________________________________

    ....
    		add_action( 'wp_head', array(&$this, 'head'));
    		add_action( 'admin_head', array(&$this, 'head'));
    		add_action( 'wp_footer', array(&$this, 'footer'));
    		add_action( 'admin_footer', array(&$this, 'footer'));
    ....
    	function head()
    	{
    		//wp_register_script('jquery');
    
    		$themes = $this->get_installed_themes(AJAXY_THEMES_DIR, 'themes');
    		$style = AJAXY_SF_PLUGIN_URL."themes/default/style.css";
    		$style_common = AJAXY_SF_PLUGIN_URL."themes/common.css";
    		$theme = $this->get_style_setting('theme');
    		$css = $this->get_style_setting('css');
    		if(isset($themes[$theme])){
    			$style = $themes[$theme]['stylesheet_url'];
    		}

    __________________________________
    ???

    https://www.ads-software.com/plugins/ajaxy-search-form/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello, I had the same problem. To solve it, I modified the sf.php file like this :

    Find the head() function and cut the part :

    //wp_register_script('jquery');
    		$x = AJAXY_SF_PLUGIN_URL."js/sf.js";
    		$script = '
    		<script type="text/javascript">
    			/* <![CDATA[ */
    				var sf_position = '.$this->get_style_setting('results_position', 0).';
    				var sf_templates = '.json_encode($this->get_templates('more')).';
    				var sf_input = "'.(trim($this->get_style_setting('input_id', '.sf_input')) == "" ? '.sf_input' : $this->get_style_setting('input_id', '.sf_input')).'";
    				jQuery(document).ready(function(){
    					jQuery(sf_input).ajaxyLiveSearch({expand: '.$this->get_style_setting('expand', 'false').', searchUrl: "'.str_replace('"', '\"', $this->get_style_setting('search_url',  home_url().'/?s=%s')).'", text: "'.$label.'", delay:'.$this->get_style_setting('delay', 500).', iwidth:'.$this->get_style_setting('width', 180).', width:'.$this->get_style_setting('results_width', 315).', ajaxUrl:"'.$this->get_ajax_url().'"});
    				});
    			/* ]]> */
    		</script>';
    		echo $script.'<script src="'.$x.'" type="text/javascript"></script>
    		<!-- END -->';

    Put it un the empty footer() function.

    Go back top of the document in the actions() function and add a priority to wp_footer in order to make the scripts load after jquery :

    add_action( 'admin_footer', array(&$this, 'footer'), 100);

    Hope that’ll help ??

    And dear developers, please, try stopping adding scripts at the top, it’s a real pain in the neck, and try registering scripts like it should be, have a look at the wp_enqueue_script doc.

    Thanks for the work indeed ??

    Thread Starter bhbilbao

    (@bhbilbao)

    Thanks for your time desirelabs!

    I will try it soon.

    10Points for you. ;D

    kiran kola

    (@kola-kiran)

    It is not working

    need to remove

    function footer()
    {
    //echo script
    }

    Line also

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Load in footer’ is closed to new replies.