Home › Forum › Plugin e temi di WP › Inserire un div con del contenuto nell’index.php
-
AutorePost
-
-
23 Ottobre 2009 alle 22:45 #11930MirteaPartecipante
Inserire un div con del contenuto nell’index.php
Salve ragazzi..
Prima di tutto mi presento “Gigi†è il mio primo post su questo forum quindi vi ringrazio in anticipo del vostro supporto..
Il mio problema è questo: voglio inserire “un div 900*300px †con del codice javascipt e un file swf nella parte di sopra dell’index.php del tema. Per fare questo ho creato un div con degli ID un che ospita tutto il contenuto(codice + swf), che al suo interno ha altri due div rispettivamente il file swf e il codice javascript .
Ho fatto questo per avere il div solo nella home “ questo è volutoâ€
Premessa:
Ho una buona conoscenza dei fogli di stile e so come si inserisce i file swf
Per praticità ho inserito lo style nella index.php
Il codice che ho inserito è il seguente :
<style type=”text/css”>
<!–
#tv_televisore {
height: 330px;
width: 900px;
border: 1px solid #000000;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
#news {
height: 250px;
width: 450px;
float: right;
border-left-style: solid;
border-left-width: 1px;
border-left-color: #999999;
margin-top: 20px;
}
#tv {
float: left;
height: 300px;
width: 400px;
}
–>
<–! Fine stile–>
<div id=”tv_televisore”>
<div id=”tv”>plug + swf</div>
<div id=”news”>
<div align=”center”>codice java</div>
</div>
</div>
Se provo la parte di codice singolarmente va alla grande il file swf funzione e il codice java anche ( è un piccolo script per le news)
Ma come lo inserisco nella pagina index.php del tema non va!!
Codice della pagina index.php del tema:
<?php get_header(); ?>
<style type=”text/css”>
<!–
#tv_televisore {
height: 330px;
width: 900px;
border: 1px solid #000000;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
#news {
height: 250px;
width: 450px;
float: right;
border-left-style: solid;
border-left-width: 1px;
border-left-color: #999999;
margin-top: 20px;
}
#tv {
float: left;
height: 300px;
width: 400px;
}
–>
</style>
<div id=”right-content”>
<!– mia parte di codice –>
<div id=”tv_televisore”>
<div id=”tv”>plug + swf</div>
<div id=”news”>
<div align=”center”>codice java</div>
</div>
</div>
<div class=”entrytop”></div>
<div id=”post-entry”>
<?php if (have_posts()) : ?>
<h1 class=”title”>New Videos:</h1>
<?php $recent = new WP_Query(“cat=1&showposts=6”); while($recent->have_posts()) : $recent->the_post();?>
<div class=”item1″ onmouseover=”this.className=’item2′” onmouseout=”this.className=’item1′”>
<?php if( get_post_meta($post->ID, “thumb”, true) ): ?>
<p>” title=”<?php the_title(); ?>”>
” height=”120″ width=”160″ alt=”<?php the_title(); ?>” /></p>
<?php else: ?>
<p>” title=”<?php the_title(); ?>”>
” height=”120″ width=”160″ alt=”<?php the_title(); ?>” /></p>
<?php endif; ?>
<div class=”kategori”>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></div>
<div class=”rate”><?php if(function_exists(‘the_ratings’)) { the_ratings(); } ?></div>
<div class=”views”><?php if(function_exists(‘the_views’)) { the_views(); } ?> </div>
<div class=”clear”></div>
</div>
<?php endwhile; ?>
<div class=”clear”></div>
<h1 class=”title”>New Games:</h1>
<?php $recent = new WP_Query(“cat=1&showposts=6”); while($recent->have_posts()) : $recent->the_post();?>
<div class=”item1″ onmouseover=”this.className=’item2′” onmouseout=”this.className=’item1′”>
<?php if( get_post_meta($post->ID, “thumb”, true) ): ?>
<p>” title=”<?php the_title(); ?>”>
” height=”120″ width=”160″ alt=”<?php the_title(); ?>” /></p>
<?php else: ?>
<p>” title=”<?php the_title(); ?>”>
” height=”120″ width=”160″ alt=”<?php the_title(); ?>” /></p>
<?php endif; ?>
<div class=”kategori”>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></div>
<div class=”rate”><?php if(function_exists(‘the_ratings’)) { the_ratings(); } ?></div>
<div class=”views”><?php if(function_exists(‘the_views’)) { the_views(); } ?> </div>
<div class=”clear”></div>
</div>
<?php endwhile; ?>
<div class=”clear”></div>
<h1 class=”title”>New Photos:</h1>
<?php $recent = new WP_Query(“cat=1&showposts=6”); while($recent->have_posts()) : $recent->the_post();?>
<div class=”item1″ onmouseover=”this.className=’item2′” onmouseout=”this.className=’item1′”>
<?php if( get_post_meta($post->ID, “thumb”, true) ): ?>
<p>” title=”<?php the_title(); ?>”>
” height=”120″ width=”160″ alt=”<?php the_title(); ?>” /></p>
<?php else: ?>
<p>” title=”<?php the_title(); ?>”>
” height=”120″ width=”160″ alt=”<?php the_title(); ?>” /></p>
<?php endif; ?>
<div class=”kategori”>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></div>
<div class=”rate”><?php if(function_exists(‘the_ratings’)) { the_ratings(); } ?></div>
<div class=”views”><?php if(function_exists(‘the_views’)) { the_views(); } ?> </div>
<div class=”clear”></div>
</div>
<?php endwhile; ?>
<div class=”clear”></div>
<?php else: ?>
<h2>Sorry, but you are looking for something that isn’t here.</h2>
<?php endif; ?>
</div>
<?php include (TEMPLATEPATH . ‘/right-sidebar.php’); ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
-
23 Ottobre 2009 alle 23:18 #68991degraPartecipante
Hai provato a mettere lo style tra head e /head in header.php?
(non postare codice direttamente sul forum, usa servizi tipo pastebin)
-
23 Ottobre 2009 alle 23:22 #68992MirteaPartecipante
si… ho provato anche a caricarlo nella pag dell’head tutto il div e va bene!! però si vede n tutte la pag. chiaramente.
-
24 Ottobre 2009 alle 8:19 #68993SteveAglAmministratore del forum
Metti quel codice in una condizione del tipo is_home ed apparirà solo in nella homepage
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.