Home › Forum › Plugin e temi di WP › Diverso sfondo per categoria
-
AutorePost
-
-
3 Gennaio 2013 alle 15:00 #23462DoppiaJPartecipante
Salve a tutti!
Nel mio blog vorrei fare in modo che quando un utente apre un articolo di una data categoria si modifichi un parametro del file .css in base alla categoria di appartenenza dell’articolo…
Mi spiego meglio http://tuttopariamiento.altervista.org/ come potete vedere nella home c’è come testata il dollaro e le monete… io vorrei che cliccando per esempio un articolo della categoria pronostici quell’immagine venisse cambiata in un altra…
nel file .css i parametri da modificare per ogni categoria saranno semplicemente i due link delle immagini images/content_bg.png e images/content_top.png
#content{
display: inline;
width: 999px;
float: left;
margin: 0px 0px 0px 57px;
background: url(images/content_bg.png) repeat-y;
padding-bottom:15px;
}
#content_text{
width: 999px;
float: left;
margin: 0px 0px 0px 0px;
background: url(images/content_top.png) top no-repeat;
}
Sareste cosଠgentili da indicarmi la retta via? -
3 Gennaio 2013 alle 15:12 #100018
-
3 Gennaio 2013 alle 15:28 #100020DoppiaJPartecipante
http://www.wpitaly.it/forum/topic.php?id=44501
Quindi io dovrei utilizzare il tag
is_category( '9' )
Quando si visualizza una pagina di archivio per la Categoria 9.
Come scrivo il codice? Non ne capisco niente di php... saresti cosଠgentile da dirmi come fare? -
3 Gennaio 2013 alle 15:45 #100022elmaniseroPartecipante
Prova questo, da mettere sotto wp_head() ,il codice css te lo sistemi come vuoi
<?php if (is_category()) :
global $cat;
if ($cat == 9) :
?>
<style type=”text/css”>
#content {background-image:url(http://tuosito.com/wp-content/themes/tuotema/images/background2.jpg) !important;}
</style>
<?php
endif;
endif; ?>
-
3 Gennaio 2013 alle 15:58 #100023DoppiaJPartecipante
Non si vede nulla…
Quando entro nella categoria Pronostici (numero 4) non cambia nulla, anzi scompare lo sfondo dove c’è l’articolo scritto (non era quello che doveva cambiare)
Il codice che ho inserito è questo:
<?php if (is_category()) :
global $cat;
if ($cat == 4) :
?>
<style type="text/css">
#content {display: inline;
width: 999px;
float: left;
margin: 0px 0px 0px 57px;
background: url(images/calcio_bg.png) repeat-y;
padding-bottom:15px; !important;}
</style>
<?php -
3 Gennaio 2013 alle 16:39 #100024elmaniseroPartecipante
A parte che mancano gli endif, poi non sto a controllare anche il tuo sito per vedere cosa devi cambiare, prova a mettere questo nel file functions.php dopo che hai creato dei fogli di stile con nomi diversi.
function cat1style_css() {
if (is_category(‘1’)) {?>
<link rel=”stylesheet” type=”text/css” href=”<?php echo bloginfo(‘stylesheet_directory’) ?>/cat1.css” /> <?php }
}
add_action(‘wp_head’, ‘cat1style_css’);
function cat2style_css() {
if (is_category(‘2’)) {?>
<link rel=”stylesheet” type=”text/css” href=”<?php echo bloginfo(‘stylesheet_directory’) ?>/cat2.css” /> <?php }
}
add_action(‘wp_head’, ‘cat2style_css’);
-
3 Gennaio 2013 alle 16:56 #100026elmaniseroPartecipante
Lascia stare con content, ho guardato il tuo sito è quella immagine è dentro container
-
3 Gennaio 2013 alle 17:44 #100030DoppiaJPartecipante
Ciao, come mi hai fatto notare sbagliavo codice css… ora l’ho sistema e funziona alla perfezione!
per una sola categoria ho insertito questo codice… nel caso in cui le categorie fossero 2? come faccio?
<?php if (is_category()) :
global $cat;
if ($cat == '4') :
?>
<style type="text/css">
#container {
width: 1163px;
float: left;
padding: 56px 0px 0px 37px;
background: url(<?php bloginfo('template_directory'); ?>/images/calcio_bg.png) no-repeat !important;}
#content_text{
width: 999px;
float: left;
margin: 0px 0px 0px 0px;
background: url(images/calcio_top.jpg) top no-repeat !important;}
</style>
<?php
endif;
endif; ?> -
3 Gennaio 2013 alle 17:53 #100032elmaniseroPartecipante
Te l’ho scritto sopra, oppure te lo fai modificare a pagamento da un profesionista che ci metta un elseif.
-
3 Gennaio 2013 alle 17:57 #100033DoppiaJPartecipante
Ehm… scusa ma perchè ti scaldi cosଠtanto?
-
3 Gennaio 2013 alle 18:00 #100034elmaniseroPartecipante
Perchè conosco già la storia, quando uno da una mano, poi si passa al braccio e via di seguito…. quindi ritieniti più che soddisfatto…. e come ti ho già detto in uno dei miei post c’è la soluzione alla tua domanda.
-
3 Gennaio 2013 alle 18:02 #100036DoppiaJPartecipante
Mah! Quanta presunzione… mi dispiace per te! Grazie per i consigli!
Ah dimenticavo… forse non sai che i forum servono a chiedere, e chi ne sa più di te ti aiuta rispondendo in modo gentile ed educato… io ho aperto il post ma non ti ho forzato a rispondere, se non volevi aiutarmi non entravi nella discussione.
-
3 Gennaio 2013 alle 18:13 #100037elmaniseroPartecipante
Ma cosa stai blaterando, non ti ho aiutato? Hai la risposta anche alla tua seconda richiesta e mi fai pure la morale sui forum e sulla gentilezza.
Tu cosa fai qui? Aiuti qualcuno? NO
Io si, se non ti sta bene come lo faccio ignorami e non darmi del presuntuoso e maleducato e stai pur certo che alle tue richieste non risponderò più.
-
3 Gennaio 2013 alle 18:26 #100039elmaniseroPartecipante
Continua ad offendere. Chiedo cortesemente ai moderatori di cancellare i post di offesa nei miei riguardi. Grazie.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.