06-04-2022, 10:38 PM
5

Topic de la v1
Debes agradecer para ver el contenido...
Básicamente se puede realizar tranquilamente desde cero:
1 - Buscan en inc/class/c.posts.php y van hasta la última llave }
Código PHP: ( Seleccionar Todo )
/*
OBTENER LOS TITULOS DE LOS POSTS ANTERIOR/SIGUIENTE
*/
public function getTitles($from) {
global $tsCore;
$pid = (int)$_GET["post_id"];
$pid = $from ? $pid - 1 : $pid + 1;
$opt = $from ? "<" : ">";
if($pid < 0) return false;
// Post
$sql = db_exec([__FILE__, __LINE__], "query", "SELECT post_id, post_title, c_seo FROM p_posts LEFT JOIN p_categorias ON post_category = cid WHERE post_id = {$pid}");
// Existe?
if(db_exec('num_rows', $sql) === 0) {
$sql = db_exec([__FILE__, __LINE__], "query", "SELECT post_id FROM p_posts WHERE post_id {$opt} {$pid} ORDER BY post_id DESC LIMIT 1");
}
$data = db_exec('fetch_assoc', $sql);
if(!empty($data)) {
$data["post_title"] = $tsCore->setSEO($data["post_title"]);
$data["post_url"] = "{$tsCore->settings["url"]}/posts/{$data["c_seo"]}/{$data["post_id"]}/{$data["post_title"]}.html";
}
return !empty($data) ? $data : false;
}
2 - En inc/php/posts.php buscan
Código PHP: ( Seleccionar Todo )
$tsPages['autor'] = $tsPost['post_user'];
y debajo agregan
Código PHP: ( Seleccionar Todo )
$smarty->assign("tsAnterior", $tsPosts->getTitles(true));
$smarty->assign("tsSiguente", $tsPosts->getTitles(false));
3 - Luego buscan en tema/templates/modules/m.posts_content.tpl y buscan
Código: ( Seleccionar Todo )
{if $tsPost.user_firma && $tsConfig.c_allow_firma}
y arriba agregan (o donde deseen), obviamente ustedes lo tendrían que adaptar a su theme... Pero si usan bootstrap no tiene que hacer tantos cambios.
Código: ( Seleccionar Todo )
<div class="post-antsig">
<div class="post-anterior">
<a href="{$tsAnterior.post_url}" class="d-flex justify-content-start align-items-center">
<div class="icon ml-2">
<!-- Acá puede ir un icono o imagen, deciden ustedes -->
<i class="icon-angle-left"></i>
</div>
<div class="titulo">
<small class="text-uppercase">No te piedas</small>
<span>{$tsAnterior.post_title|truncate:34}</span>
</div>
</a>
</div>
<div class="post-siguiente">
<a href="{$tsSiguente.post_url}" class="d-flex justify-content-end align-items-center t-end">
<div class="titulo">
<small class="text-uppercase">A continuación</small>
<span>{$tsSiguente.post_title|truncate:34}</span>
</div>
<div class="icon mr-2">
<!-- Acá puede ir un icono o imagen, deciden ustedes -->
<i class="icon-angle-right"></i>
</div>
</a>
</div>
</div>
Así quedaría terminado!
[img]Registrate o inicia tu sesión para ver este contenido[/img]