Forums

[resolved] Tag Archive Help (6 posts)

  1. zenducation
    Member
    Posted 1 year ago #

    Hello, I run a website at http://zenducation.net and I was wondering if someone could help me with a problem with my tag archive.

    I currently display only one post on my homepage, which is what I want, but for my tag archive (when you click on a particular tag), I want to display all of the posts for that tag.

    Could someone help me do that?

    Thanks in advance.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  3. zenducation
    Member
    Posted 1 year ago #

    Can you tell me basically what coding I have to do? I am not experienced in php. I would greatly appreciate it.

  4. Mark / t31os
    Moderator
    Posted 1 year ago #

    Go back into the Reading settings and set the posts per page setting to the desired amount for all your pages (not what you want for home, i'll get to that).

    Once you've done that, add this to your theme's functions.php file.

    function home_posts_per_page( $query ) {
    	if( $query->is_home )
    		$query->set( 'posts_per_page' , 1 );
    	return $query;
    }
    add_filter( 'pre_get_posts' , 'home_posts_per_page' );

    Reference of other threads with similar questions, using similar code.
    http://wordpress.org/support/topic/347269
    http://wordpress.org/support/topic/393462
    http://wordpress.org/support/topic/367338

    NOTE: Please ensure code is pasted correctly, after an opening PHP tag, eg. <?php, most likely easiest if you place the code after the first line with the opening tag.

  5. zenducation
    Member
    Posted 1 year ago #

    Thank you so much. It worked great!

  6. Mark / t31os
    Moderator
    Posted 1 year ago #

    You're welcome. :)

Topic Closed

This topic has been closed to new replies.

About this Topic