Limitar publicaciones en la página de inicio de WordPress

  • Autor Autor julsar
  • Fecha de inicio Fecha de inicio
julsar

julsar

Eta
Verificación en dos pasos activada
Verificado por Whatsapp
buenas a todos! no consigo limitar el numero de post que muestra el home.

He probado a modificarlo desde ajustes pero nada. luego he intentado a seguir lo de este tutorial pero ni caso.


http://forobeta.com/wordpress/195883-limitar-numero-de-entradas-pagina-principal-exclusivamente.html


Uso el tema Sparkling y mi index es este:

PHP:
<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package sparkling
 */

get_header(); ?>

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">

		<?php if ( have_posts() ) : ?>

			<?php /* Start the Loop */ ?>
			<?php while ( have_posts() ) : the_post(); ?>

				<?php
					/* Include the Post-Format-specific template for the content.
					 * If you want to override this in a child theme, then include a file
					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
					 */
					get_template_part( 'content', get_post_format() );
				?>

			<?php endwhile; ?>

			<?php sparkling_paging_nav(); ?>

		<?php else : ?>

			<?php get_template_part( 'content', 'none' ); ?>

		<?php endif; ?>

		</main><!-- #main -->
	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>


ayuda please!!
 
Entra el el panel: dominio.com//wp-admin/options-reading.php

luego busca

Screenshot_11.webp

Y cambia el numero 10 por 20 por ejemplo.

en el archivo del theme donde genera las noticias, tienes que tener este loop:

Insertar CODE, HTML o PHP:
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> 

   <?php the_content(); ?>

<?php endwhile; ?>

Si quieres acortar el numero de la intro, tienes que cambiar

Insertar CODE, HTML o PHP:
<?php the_content(); ?>

por

Insertar CODE, HTML o PHP:
<?php echo wp_trim_words( get_the_content(), 40, '...' ); ?>

si quieres más y/o menos hay que cambiar el numero "40" en el codigo.

Un saludo.
 
gracias alyen pero no doy con ello. lo q me dices es lo de cambiarlo desde ajustes del WP, no?? ya esta cambiado pero nada.

mi index lo tienes arriba y lo que tiene no es exactamente lo que tu dices tal cual...
 
Yo uso este loop, puede que te sirva. :encouragement:

PHP:
<?php $recent = new WP_Query("showposts=1"); ?>
<?php if ($recent->have_posts()) : while($recent->have_posts()) : $recent->the_post();?>

<?php the_content(); ?>

<?php endwhile; ?>
<?php endif; ?>

Donde showposts=1 es el numero de post que se mostrara.!!!
 
gracias yeltsin, y donde lo coloco exactamente en mi index? o da igual?
 
[MENTION=4806]julsar[/MENTION] Haz una copia de tu index luego prueba de esta forma ab si te funciona.!! :encouragement:
PHP:
<?php 
/** 
 * The main template file. 
 * 
 * This is the most generic template file in a WordPress theme 
 * and one of the two required files for a theme (the other being style.css). 
 * It is used to display a page when nothing more specific matches a query. 
 * E.g., it puts together the home page when no home.php file exists. 
 * Learn more: http://codex.wordpress.org/Template_Hierarchy 
 * 
 * @package sparkling 
 */ 

get_header(); ?> 

    <div id="primary" class="content-area"> 
        <main id="main" class="site-main" role="main"> 

<?php /* Start the Loop */ ?> 

<?php $recent = new WP_Query("showposts=1"); ?> 
<?php if ($recent->have_posts()) : while($recent->have_posts()) : $recent->the_post();?> 

                <?php 
                    /* Include the Post-Format-specific template for the content. 
                     * If you want to override this in a child theme, then include a file 
                     * called content-___.php (where ___ is the Post Format name) and that will be used instead. 
                     */ 
                    get_template_part( 'content', get_post_format() ); 
                ?> 

            <?php endwhile; ?> 

            <?php sparkling_paging_nav(); ?> 

        <?php else : ?> 

            <?php get_template_part( 'content', 'none' ); ?> 

        <?php endif; ?> 


        </main><!-- #main --> 
    </div><!-- #primary --> 

<?php get_sidebar(); ?> 
<?php get_footer(); ?>
 
gracias yeltsin! acabo de probar pero nada, no hace ni **** casi sigue mostrando las 10 🙁
 
En wordpress tienes que ir a ajustes > general y pones el numero en la opcion para ello
 
optimus es lo primero que he hecho pero nada. 🙁
 
optimus es lo primero que he hecho pero nada. 🙁

¿No estarás usando Chrome para ver los cambios no? Chrome tiene caché persistente, trata de no actualizar nada siempre que puede (para dar la impresión de que es un navegador rápido cuando es más lentooooooooooooooooo). Además si usas caché tienes que vaciarla.

Prueba con otro navegador, especialmente en modo privado/incógnito/porno o con el plugin zemante.

Si no funciona debe ser un problema del theme, deberías reportarlo al autor del mismo.
 

si, exacto. :encouragement:

- - - Actualizado - - -

¿No estarás usando Chrome para ver los cambios no? Chrome tiene caché persistente, trata de no actualizar nada siempre que puede (para dar la impresión de que es un navegador rápido cuando es más lentooooooooooooooooo). Además si usas caché tienes que vaciarla.

Prueba con otro navegador, especialmente en modo privado/incógnito/porno o con el plugin zemante.

Si no funciona debe ser un problema del theme, deberías reportarlo al autor del mismo.

si, pero he entrado con mozilla tb y nada. 🙁
 
si, exacto. :encouragement:

- - - Actualizado - - -



si, pero he entrado con mozilla tb y nada. 🙁

Si estás usando Sparkling es un theme que carga los posts uno tras otro en "río continuo" no se pueden limitar los posts, pensé en usar ese theme pero no me agrada ese sistema.
 
Pero lo eh instalado y si me limita lo post en Ajustes > lectura
que raro, a mi si me funciona.!!
 
Si estás usando Sparkling es un theme que carga los posts uno tras otro en "río continuo" no se pueden limitar los posts, pensé en usar ese theme pero no me agrada ese sistema.

aqui no dice eso: Limit Number Of Posts On Front Page - Colorlib

Pero lo eh instalado y si me limita lo post en Ajustes > lectura
que raro, a mi si me funciona.!!

no jodas?? ya es elcolmo, q coño puede ser entonces?? ahora pongo cap de como lo tengo


aqui: Screenshot by Lightshot
 
ahi tienes que salgan 4 entradas.!!
 
claro, es lo que quiero! me salen 10! 🙁
 
En principio prefiero reservarmelo 🙁
 
Atrás
Arriba