Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nierdz

    (@nierdz)

    Ok, I finally found it. I had to do it in a plugin and RTFM add_filter documentation 🙂
    Just in case somebody needs it, here is the solution (a little bit ugly but it works)

    Create a plugin and fill it with this content :

    <?php
    /*
    Plugin Name: Development Theme Switcher
    Plugin URI: tenminutestokill.com
    Description: Map theme to specific domain name
    Version: 0.1
    Author: nierdz
    Author URI: http://tenminutestokill.com/
    License: GPL
    */
    
    //Ajout du support du theme de dev
    if ($_SERVER['HTTP_HOST'] === 'dev.tenminutestokill.com') {
            add_filter( 'template', 'TMTKdev' );
            add_filter( 'stylesheet', 'TMTKdev' );
            add_filter( 'option_template', 'TMTKdev' );
            add_filter( 'option_stylesheet', 'TMTKdev' );
    }
    
    function TMTKdev() {
            return 'TMTKdev';
    }
    ?>
    Thread Starter nierdz

    (@nierdz)

    Just for information, I did it like this, for the moment :

    function recursive_array_search($needle,$haystack) {
    		foreach($haystack as $key=>$value) {
    			$current_key=$key;
    			if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value) !== false)) {
    				return $current_key;
    			}
    		}
    		return false;
    	}
    	function remove_numbers($string) {
      		$vowels = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ");
      		$string = str_replace($vowels, '', $string);
      		return $string;
    	}
    	//give an array on sidebars registered
    	$args = get_option('sidebars_widgets');
    
    	//get the widget id without the number
    	$widget_id = remove_numbers($this->id);
    
    	//get the sidebar if of the widget
    	$sidebar_id = recursive_array_search('eshopwi_cart_ajaxed-8',$args);

    In my case $sidebar_id = ‘sidebar-1’
    So i get what i was searching for but i hope there is something more elegant to do it…

    Thread Starter nierdz

    (@nierdz)

    Thank you but this is not exactly what i’m searching for.
    Actually it gives me this :
    Array
    (
    [wp_inactive_widgets] => Array
    (
    [0] => pages-2
    [1] => calendar-2
    [2] => links-2
    [3] => text-2
    [4] => rss-2
    [5] => tag_cloud-2
    [6] => nav_menu-2
    [7] => search-2
    [8] => recent-posts-2
    [9] => recent-comments-2
    [10] => archives-2
    [11] => categories-2
    [12] => meta-2
    )

    [sidebar-1] => Array
    (
    [0] => eshopwi_cart_ajaxed-8
    )

    [sidebar-2] => Array
    (
    )

    [array_version] => 3
    )

    I know i can point ‘sidebar-1’ by searching ‘eshopwi_cart_ajaxed’.
    But, i think there’s a function out there to get it directly, no ?
    For the moment i will use this but if anybody have an idea to get ‘sidebar-1’ directly, let me know about.

    Hello, i went on your site and the css is missing (http://padraigstapleton.net/wordpress/wp-content/themes/twentyten/style.css) i got a 404.
    Try to remove all properly and to reupload all the files.

Viewing 4 replies - 1 through 4 (of 4 total)