Risposte nei forum create
-
AutorePost
-
essezetaPartecipante
per cambiare esattamente il logo di wp-login.php apri wp-admincsslogin.css e alle righe 41-49 trovi l’url dell’immagine da visualizzare, la sostituisci ()rispetta le dimensioni…) e hai fatto…
ecco il brano di css con l’immagine da sostituire in bold…
h1 a {
background: url(../images/logo-login.gif) no-repeat;
width: 292px;
height: 66px;
text-indent: -9999px;
overflow: hidden;
padding-bottom: 15px;
display: block;
}
essezetaPartecipante…anche il mitico hemingway lavora su due blocchi…
e visto che parli di “crearne uno cosଔ immagino che ci sappia smanettare un po’… allora su hemingway è semplice apportare modifiche e ottenre anche 3-4 blocchi più sottili…
io l’ho fatto come test d’allenamento per creare il mio tema personalizzato…
provaci te lo consiglio!!
essezetaPartecipanteScusate…
piccola rettifica…
Se si può lavorare di condizioni l’ideale sarebbe condizionare all’interno di post-new.php in cui alla fine include edit-form-advanced.php…
quando sono Admin, includo edit-form-advanced.php
altrimenti includo mod_of_edit-form-advanced.php
una cosa tipo:
<?php
// Show post form.
$post = get_default_post_to_edit();
if ( is_user(admin) {
include(‘edit-form-advanced.php’);
} else {
include(‘mod_of_edit-form-advanced.php’);
}
?>
Siamo in post-new.php, ultime righe…
Che ne pensi Steve (e/o altri esperto)?
essezetaPartecipante…x mrbrown:
non capisco la tua domanda… l’utente che salva il post lo salva nella cat di default, in genere “senza categoria”, ma puoi settare quella che ti pare…
ad ogni modo commentando funziona… nella 2.5.1 basta agire su edit-form-advanced.php (righe 216-249)…
solo che è davvero BRUTALE, e poi ogni volta che dovrei mettere ordine mi tocherebbe decommentare il codice… per poter gestire le categorie…
Mi chiedevo quindi: posso condizionare questo pezzo di codice? o le condizioni funzionao solo nel tema? Non credo, ma se si può fare, che condizione gli imposto? dovrei impostare una condizione del tipo IF_is_user (in modo che quando è in sessione admin, il codice mi compare, altrimenti NO), ma ho cercato e non mi sembra esista una condizione sull’utente in sessione… magari può aiutarmi Steve?
A Steve vorrei chiedere inoltre più dettagli sulla faccenda degli “agganci”… cosa intendi???
magari indicami dove posso documentarmi…
Grazie
g
essezetaPartecipantemi vergogno un po’ ad aver chiesto questa cosa già bella e predisposta da WP…
chiedo scusa (a volte le cose che abbiamo sotto il naso ci sono più estranee di quelle lontane…)
x mrbrown: grazie mille!!
essezetaPartecipanteQuasi perfetto…
Ora riesco a fare entrambe le cose:
- sia a visualizzare i post del mese corrente (tra parentesi la necessità nasce da ciò: immaginate di dover gestire un mensile on line… impostate la visualizzazione di 99 post, ma finché c’è un solo post volete che venga visualizzato solo quello)
- sia a visualizzare i tasti di navigazione verso i mesi precedenti e da questi verso i successivi…
L’unica cosa è che non capisco esattamente come si imposta lo START… cioè la data a partire dalla quale comincia la visualizzazione dei post… c’è un valore numerico, ma a numero uguale non corrisponde mese uguale… devo procedere sempre a tentativi… qualcuno è in grado di spiegarmi come conta i mesi questo script? vedi il pezzo di codice in grassetto
+ se qualcuno nota una scrittura poco pulita e mi volesse dare una dritta per semplificare il codice e le funzioni, gliene sarei grato…
Comunque per come è ora questo codice è funzionante, eccolo postato qui di seguito (lascio anche i commenti originali) e all’opera su kubric a questo link
Un saluto a tutti…
<!–//custom query code check for cmonth added by the monthly nav–>
<?php $cmonth = $_GET[“cmonth”];
if($cmonth==””){$cmonth = 0;}
//get the month minus the offset of cmonth
$current_month = date(‘m’, strtotime($date.’-‘.$cmonth . ‘months’ ));
//get the year minus the offset of cmonth
$current_year = date(‘Y’, strtotime($date.’-‘.$cmonth . ‘months’ ));
//make the query
query_posts(“monthnum=$current_month&year=$current_year&order=DESC”); ?>
<!–The last, and trickiest part is the navigation, which changes the $cmonth parameter in th URL string:–>
<!–//set values for the next and previous cmonth–>
<?php $cmonth_num_plus = $cmonth + 1; ?>
<?php $cmonth_num_minus = $cmonth – 1; ?>
<!–//set up a way to check the first day–>
<?php $cmonth_check = $current_month-$cmonth; ?>
<!–//set the date that your blog starts from
//there should be no blog posts earlier than this date
//in this example the start date is sept 2007
//the month is represented by a number–>
<?php $start_month = -4; ?>
<?php $start_year = 2008; ?>
<!–//set the divider between the links–>
<?php $divider = ‘ | ‘; ?>
<!–//if the previous month exists display the ‘previous’ link–>
<?php if($current_year >= $start_year && $cmonth>$start_month){
echo ‘<a href=”‘.get_bloginfo(‘url’).’/?cmonth=’;
echo $cmonth_num_plus.'”>« Previous Month’;
} ?>
<!–//if there is a ‘previous’ and ‘next’ display the divider–>
<?php if($current_year >= $start_year && $cmonth_check>$start_month && $cmonth>0)
{echo $divider;} ?>
<!–//if its not the current month display the ‘next’ link–>
<?php if($cmonth>0){
echo ‘<a href=”‘.get_bloginfo(‘url’).’/?cmonth=’;
echo $cmonth_num_minus.'”>Next Month »’;
} ?>
<!–//set a parameter i as 1 this helps to identify the first post–>
<?php $i=1 ?>
<!–//loop starts–>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!–//display the month and year at the top of the page–>
<?php if($i==’1′){echo ‘
<h1>’; the_time(‘F Y’); echo ‘</h1>
‘;} ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2>“><?php the_title(); ?></h2>
<small><?php the_time(__(‘F jS, Y’, ‘kubrick’)) ?> <!– by <?php the_author() ?> –></small>
<div class=”entry”><?php the_content(__(‘Read the rest of this entry »’, ‘kubrick’)); ?></div>
</div>
<!–//increase i through the loop–>
<?php $i++; ?>
<?php endwhile; else: ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<!–//end the loop–>
<?php endif; ?>
essezetaPartecipanteTranquillissimo wolly, certo che ho pazienza… ci mancherebbe…
I miei aggiornamenti del post sono dovuti a piccoli sviluppi che riesco a mano a mano a fare da solo…
Semplicemente aggiorno il mio caso, che steve avrebbe già risolto, ma magari ci riesco da solo… (chissà !! ) io intanto condivido i miei piccoli passi pubblicandoli… tutto qua…
comunque grazie mille dell’attenzione
g
essezetaPartecipanteAggiorno la faccenda…
una delle due cose l’ho risolta, l’altra no… nessuno sa indicarmi una soluzione?
Sono riuscito a far visualizzare la lista dei post del mese corrente… ecco:
<?php $cmonth = $_GET["cmonth"]; ?>
<?php if($cmonth==""){$cmonth = 0;}
$current_month = date('m', strtotime($date.'-'.$cmonth . 'months' ));
$current_year = date('Y', strtotime($date.'-'.$cmonth . 'months' ));
query_posts("monthnum=$current_month&year=$current_year&order=DESC"); ?>
<?php $i=1 ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if($i=='1'){echo '
<h1>'; the_time('F Y'); echo '</h1>
';} ?>
<!--post title -->
<h2><?php the_title(); ?></h2>
<?php the_content(__('Read more'));?>
<?php $i++; ?>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
Ora però non riesco a creare una navigazione che mi permetta di accedere alle mensilità precedenti e da queste a quelle successive...
Ho questo codice, che però non mi genera niente...
<?php $cmonth_num_plus = $cmonth + 1; ?>
<?php $cmonth_num_minus = $cmonth - 1; ?>
<?php $cmonth_check = $current_month-$cmonth; ?>
<?php $start_month = 5; ?>
<?php $start_year = 2008; ?>
<?php $divider = ' | '; ?>
<?php if($current_year >= $start_year && $cmonth_check>$start_month){
echo '<a href="'.get_bloginfo('url').'/?cmonth=';
echo $cmonth_num_plus.'">« Previous Month';
}
if($current_year >= $start_year && $cmonth_check>$start_month && $cmonth>0)
{echo $divider;}
if($cmonth>0){
echo '<a href="'.get_bloginfo('http://localhost/ildiavoloa4').'/?cmonth=';
echo $cmonth_num_minus.'">Next Month »';
} ?>
Grazie
g
essezetaPartecipanteHo trovato un post in cui viene illustrato proprio ciò che cercavo, how to create a monthly navigation system, eccolo qui…
Però non mi funziona… mi dà errore…
Qualcuno mi sa dire cosa sbaglio?
Ecco cosa inserisco in index.php, o meglio cosa cerco di inserire…
1 – Codice per creare una query
ecco il codice:
//custom query code
//check for cmonth added by the monthly nav
$cmonth = $_GET["cmonth"];
if($cmonth==""){$cmonth = 0;}
//get the month minus the offset of cmonth
$current_month = date('m', strtotime($date.'-'.$cmonth . 'months' ));
//get the year minus the offset of cmonth
$current_year = date('Y', strtotime($date.'-'.$cmonth . 'months' ));
//make the query
query_posts("monthnum=$current_month&year=$current_year&order=DESC");
2 - Codice per visualizzare label del mese corrente e contenuti
ecco il codice:
//set a parameter i as 1
//this helps to identify the first post
$i=1
//loop starts
if (have_posts()) : while (have_posts()) : the_post(); ?>
//display the month and year at the top of the page
<?php if($i=='1'){echo '
<h1>'; the_time('F Y'); echo '</h1>
';} ?>
<!--post title -->
<h2><?php the_title(); ?></h2>
//post content
<?php the_content(__('Read more'));?>
//increase i through the loop
<?php $i++; ?>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
//end the loop
<?php endif; ?>
3 - Navigazione verso il mese successivo o precedente...
ecco il codice:
//set values for the next and previous cmonth
$cmonth_num_plus = $cmonth + 1;
$cmonth_num_minus = $cmonth - 1;
//set up a way to check the first day
$cmonth_check = $current_month-$cmonth;
//set the date that your blog starts from
//there should be no blog posts earlier than this date
//in this example the start date is sept 2007
//the month is represented by a number
$start_month = 8;
$start_year = 2007;
//set the divider between the links
$divider = ' | ';
//if the previous month exists display the 'previous' link
if($current_year >= $start_year && $cmonth_check>$start_month){
echo '<a href="'.get_bloginfo('url').'/?cmonth=';
echo $cmonth_num_plus.'">« Previous Month';
}
//if there is a 'previous' and 'next' display the divider
if($current_year >= $start_year && $cmonth_check>$start_month && $cmonth>0)
{echo $divider;}
//if its not the current month display the 'next' link
if($cmonth>0){
echo '<a href="'.get_bloginfo('url').'/?cmonth=';
echo $cmonth_num_minus.'">Next Month »';
}
-
AutorePost