Am creat răspunsuri în forum

Vizualizare 1 răspuns (din 1 în total)
  • Salut,
    am mai continuat de la ce ai inceput tu, dar acum am aflat si eu cum se face :)!

    function _get_custom_background() {
        $bgc = get_background_color();
        $bgi = get_background_image();
        $bgStyle='style="';
    	if (!empty($bgc)) {
    		$bgStyle.="background-color:$bgc;";
    		}
    	else {$bgStyle.="background-color:black;";}
        if (!empty($bgi)){
    		$bgStyle.="background-image:url('$bgi');background-repeat:no-repeat;";
    		}
    
    	$repeat = get_theme_mod( 'background_repeat', 'repeat' );
    	if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) {
    		$repeat = 'repeat';
    		}
    	else {
    		$repeat = " background-repeat: $repeat;";
    		}
    	$bgStyle.=$repeat;
    
    	$position = get_theme_mod( 'background_position_x', 'left' );
    	if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
    		$position = 'left';
    	$position = " background-position: top $position;";
    	$bgStyle.=$position;
    
    	$attachment = get_theme_mod( 'background_attachment', 'scroll' );
    	if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
    		$attachment = 'scroll';
    	$attachment = " background-attachment: $attachment;";
    	$bgStyle.=$attachment;
    	$bgStyle.='"';
    	return($bgStyle);
    	}
Vizualizare 1 răspuns (din 1 în total)