Home › Forum › Problemi Vari con WP › Visualizzare il percorso Pagina Madre/Figlia01/figlia02/… prima del titolo
-
AutorePost
-
-
1 Luglio 2011 alle 11:40 #18381redford74Partecipante
Ciao a tutti, ho una domanda. Vorrei che nelle pagine del mio blog, prima del titolo di ciascuna pagina, compaia il percorso della stessa. Cioè, ipotizziamo che la mia pagina abbia come titolo Pippo, ma che sia sotto-pagina di Pluto e Topolino.
Vorrei che la pagina si presenti cosà¬:
Header…
Pluto / Topolino
Pippo (titolo della pagina)
Testo della pagina etc… etc…
Qualcuno sa aiutarmi? Non dovrebbe essere difficile ma non riesco a venirne a capo.
Grazie mille.
-
1 Luglio 2011 alle 12:23 #86071TittiModeratore
Se ti può essere utile, io in cima all’articolo singolo ho il percorso, e il codice è:
& raquo; <?php echo(get_post_path($post->ID, ‘ & raquo; ‘)); ?> & raquo; <?php the_title(); ?>
Non so se è la stessa cosa per le pagine (prima di “raquo” non ci va lo spazio)
-
1 Luglio 2011 alle 13:04 #86073redford74Partecipante
non penso sia la stessa cosa per le pagine. grazie cmq per il suggerimento.
-
1 Luglio 2011 alle 13:42 #86076
-
1 Luglio 2011 alle 14:03 #86077TittiModeratore
function get_post_path($post_id,$delimiter)
-
1 Luglio 2011 alle 14:07 #86078wollyAmministratore del forum
manca tutto il resto della funzione
-
1 Luglio 2011 alle 14:11 #86079TittiModeratore
OK, aggiungo anche i commenti in russo se possono servire…
Выдает Ñтроку Ñ Ð¿ÑƒÑ‚ÐµÐ¼ до поÑта (вÑе родительÑкие категории)
*/
function get_post_path($post_id,$delimiter)
{
$out =”;
$categories = &get_the_category($post_id);
if (!$categories) return ”; //TODO: проверÑÑ‚ÑŒ на is_attachment и выводить путь до поÑта.
if (is_array($categories))
{
foreach ($categories as $category)
{
if ($out) $out .= ‘, ‘;
$out .= ‘< a href=”‘.get_category_link($category->cat_ID).'” >’.$category->name.”;
}
$category_list = get_category_parents($categories[0]->cat_ID, TRUE, $delimiter);
if (!is_string($category_list)) return ”;
$category_list =substr($category_list,0, strrpos($category_list,$delimiter));
$category_list =substr($category_list,0, strrpos($category_list,$delimiter));
if ($category_list)
$out = $category_list . $delimiter . $out;
}
return $out;
}
/*
@param $post_id int
@param $category int
определÑет, находитÑÑ Ð»Ð¸ поÑÑ‚ в заданной корневой категории
*/
-
2 Luglio 2011 alle 9:43 #86095redford74Partecipante
Ho perso il filo del discorso. State rispondendo alla mia domanda oppure siete andati su altro argomento?
Grazie.
-
2 Luglio 2011 alle 10:28 #86096wollyAmministratore del forum
è la risposta alla tua domanda, devi fare alcune ,odifiche ma per il resto è a posto.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.