Home › Forum › Plugin e temi di WP › problema tags per post simili in home page
-
AutorePost
-
-
15 Agosto 2010 alle 20:47 #14751kikko088Partecipante
ciao a tutti, ho un piccolo problema, la mia home page è composta da l’excerpt di alcune sottopagine random di una certa pagina, tutto funziona come dovrebbe ma ora che ho deciso di mettere nel footer i post simili nasce un piccolo problema, in home page non ci sono post simili, mentre nelle pagine/articoli tutto funziona.
secondo voi quale può essere il motivo?
ilplugin che ho usato per i post correlati è http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/installation/ ma la stessa cosa succede con simple tags.
Io sono poco esperto ma penso che il problema risieda nel fatto che con il codice per l’excerpt random non ci sia il richiamo dei tags, di conseguenza il plugin non trova nessun tags da confrontare per inserire i post simili, può essere?come posso risolvere?
questo è il codice usato in home page per l’excerpt random
<?php global $post; $myposts = get_posts('post_parent=172&post_type=page&orderby=rand&numberposts=1'); ?>
<?php foreach( $myposts as $post ) : setup_postdata( $post ); ?>
<?php the_post_thumbnail('medium'); ?>
<h2>"><?php the_title(); ?></h2>
<div style="clear: both;"></div>
<?php the_excerpt(); ?>
<?php endforeach; wp_reset_query(); ?>
ps. ho notato che se metto
<?php wp_related_posts(); ?>
all'interno del codice scritto sopra mi mostra i post correlati, diversamente se lo inserisco fuori da questo codice non mostra nulla!
kikko088`
-
16 Agosto 2010 alle 4:42 #76296PaperPartecipante
Per la questione codice lascio la parola a chi questa cosa l’ha già fatta, però posso dirti questo: Hai provato ad usare Yet Another Related Posts Plugin (YARPP)?
Ovviamente non sarebbe una soluzione al tuo problema, ma una soluzione per aggirarlo, in quanto questo plugin ha parecchie possibilità di configurazione, anche riguardo i metodi utilizzati per identificare i post correlati, che non vengono identificati solo per le tag, ma anche per il contenuto del testo, del titolo, ecc (potendo stabilire quali metodi lasicare attivi e che priorità devono avere). Quindi potresti riuscire a configurarlo in modo che riconosca i post simili come preferisci, a prescindere dal codice che hai inserito.
E’ una possibilità , poi ovviamente se risolvi con il codice è sicuramente meglio.
-
16 Agosto 2010 alle 11:46 #76305kikko088Partecipante
il plugin è fatto molto meglio degli altri, però non risolve ancora il problema, e penso che la causa sia il fatto che il richiamo della funzione è fuori dal loop
La mia idea (per quel poco che ne so di programmazione) è quella di creare 2 arrey uno che contiene i post simili di uno dei due articoli random, un’altro con gli articoli simili del secondo articolo e alla fine mettere una piccola funzione che mostra 5 post simili presi a caso da questi due arrey.
Il problema è che non ho la minima idea di come farlo
kikko088
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.