• The code below works when i want a different background per page. But i’ve to fill in all the page id’s.

    Ik would like to read the URL and say something like

    url = mydomein/wordpress/excel

    if instr(url, “excel”) then
    ‘code for theme…
    end if

    But i don’t know how to do this in PHP?

    function catchbox_enqueue_color_scheme() {
    	global $catchbox_options_settings;
        $options = $catchbox_options_settings;	
    
    	$color_scheme = $options['color_scheme'];
    
    	$catid = get_cat_ID();
    	$postid = get_the_ID();
    	$categories = get_the_category();
    	$idObj = get_category_by_slug('category-slug'); 
    
    	if (  'dark' == $color_scheme)
    		wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
    	elseif ( 482 == $postid )
    		wp_enqueue_style( 'blue', get_template_directory_uri() . '/colors/doc.css', array(), null );
    	elseif ( 'green' == $color_scheme )
    		wp_enqueue_style( 'green', get_template_directory_uri() . '/colors/green.css', array(), null );
    	elseif ( 'red' == $color_scheme )
    		wp_enqueue_style( 'red', get_template_directory_uri() . '/colors/red.css', array(), null );
    	elseif ( 'brown' == $color_scheme )
    		wp_enqueue_style( 'brown', get_template_directory_uri() . '/colors/brown.css', array(), null );
    	elseif ( 'powerpoint' == $idObj )
    		wp_enqueue_style( 'brown', get_template_directory_uri() . '/colors/ppt.css', array(), null );
    	elseif ( 738 == $postid OR 140 == $postid)
    		wp_enqueue_style( 'orange', get_template_directory_uri() . '/colors/xls.css', array(), null );			
    
    	do_action( 'catchbox_enqueue_color_scheme', $color_scheme );
    }
    add_action( 'wp_enqueue_scripts', 'catchbox_enqueue_color_scheme' );
Viewing 1 replies (of 1 total)
  • Thread Starter pacecal

    (@pacecal)

    Found i myself:

    function catchbox_enqueue_color_scheme() {
    	global $catchbox_options_settings;
        $options = $catchbox_options_settings;	
    
    	$color_scheme = $options['color_scheme'];
    	$strURL = get_permalink();
    
    	if (true == strpos($strURL, 'ms-excel'))
    		wp_enqueue_style( 'green', get_template_directory_uri() . '/colors/xls.css', array(), null );
    	elseif ( true == strpos($strURL, 'ms-powerpoint'))
    		wp_enqueue_style( 'orange', get_template_directory_uri() . '/colors/ppt.css', array(), null );
    	elseif ( true == strpos($strURL, 'ms-access'))
    		wp_enqueue_style( 'red', get_template_directory_uri() . '/colors/mdb.css', array(), null );
    	elseif ( true == strpos($strURL, 'ms-outlook'))
    		wp_enqueue_style( 'orange', get_template_directory_uri() . '/colors/out.css', array(), null );
    	elseif ( true == strpos($strURL, 'ms-word'))
    		wp_enqueue_style( 'orange', get_template_directory_uri() . '/colors/doc.css', array(), null );	
    
    	do_action( 'catchbox_enqueue_color_scheme', $color_scheme );
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Different backcolor pages/post/category’ is closed to new replies.