• I have searched and hunted throughout the internet to see if there is a plugin or a page template that might help.

    I have tried using the wp-latest-posts plugin (Both Free and Paid), I have tried to use live-composer-page-builder.1.0.8.4 but both have not worked at all.

    I’m currently using the Hueman theme, I need to make a tag archive the front static page of the site. I currently have a redirect to it but that doesn’t quite work well. I have tried the following page template to see if it works but it only pull the image and not how it shows it in the rest of the site.

    <?php get_header(); ?>
    <?php
    /**
     * Template Name: Testr
     *
     * A Page Template for displaying users/visitor's liked posts.
     *
     * @package deTube
     * @subpackage Page Template
     * @since deTube 1.1
     */
    ?>
    <section class="content">
    
    	<?php get_template_part('parts/page-title'); ?>
    
    	<div class="pad group">
    
    		<?php while ( have_posts() ): the_post(); ?>
    
    			<article <?php post_class('group'); ?>>
    
    				<?php get_template_part('parts/page-image'); ?>
    
    				<div class="entry themeform">
    <?php
    
    // The Query
    $the_query = new WP_Query( array( 'tag_id' => 1812 ) );
    
    // The Loop
    if ( $the_query->have_posts() ) {
    	echo '<a target="_blank" href="<?php the_permalink(); ?>">';
    	while ( $the_query->have_posts() ) {
    		$the_query->the_post();
    		echo '' . the_post_thumbnail() . '';
    	}
    	echo '</a>';
    } else {
    	// no posts found
    }
    /* Restore original Post Data */
    wp_reset_postdata();
    ?>					<div class="clear"></div>
    				</div><!--/.entry-->
    
    			</article>
    
    			<?php if ( hu_is_checked('page-comments') ) { comments_template('/comments.php',true); } ?>
    
    		<?php endwhile; ?>
    
    	</div><!--/.pad-->
    
    </section><!--/.content-->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Please, I really really need this to work. I just went through an entire theme re-vamp and this is the last point that is killing me right now…

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi AchoronMH. Why not just use the WP pre_get_posts() function in a child theme functions.php file to filter the query on the home page? Then you shouldn’t need a separate page template.

    Thread Starter AchoronMH

    (@achoronmh)

    So all I’d need to do is add this to the functions.php?

    function my_home_category( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'tag', '1812' );
        }
    }
    add_action( 'pre_get_posts', 'my_home_category' );

    1812 being the tag_id that I want to show?

    That looks like it should work.

    Thread Starter AchoronMH

    (@achoronmh)

    Ok I added this to the functions but it made it so that the latest posts was only filtered to tag id 1812. I need to have both an unfiltered latest posts and a filtered home page. How would it make it so that it only effects the front page rather than the front page and the latest posts?

    1 Create new page in wordpress and call it “Home” then in settings/reading set this page as static homepage – it can be empty for a while.

    Create a new template file for that page – copy page.php and name it homepage.php or w/e.

    more info:
    https://developer.www.ads-software.com/themes/template-files-section/page-template-files/page-templates/

    Now you can edit new template page in php to add custom loops, you can even add few loops in home page without affecting rest.

    Check lubelskierowerem.pl as an example because I created homepage this way, ive got last 2 or 4 post form some categories at home

    Thread Starter AchoronMH

    (@achoronmh)

    So try exactly what I tried in the first post but have absolutely no idea how?…

    What exactly are you using if I may ask?

    If I understand it correctly, you want to show “a specific” tag/category posts on your front page.

    For that I guess the easiest option would be to try any plugin which has the ability to show the posts on any page “using shortcode” and then create a page and mark it home page, and implement that shortcode there to show posts “only” from that specific tag/category.

    Let me know if this is what you’re looking at, I can probably help you with similar plugin.

    Thread Starter AchoronMH

    (@achoronmh)

    So I found something similar to that I needed to get, all I need to do is shrink the size of the featured image to a thumbnail size, Here is my page template.

    <?php get_header(); ?>
    <?php
    /**
     * Template Name: Testr
     *
     * A Page Template for displaying users/visitor's liked posts.
     *
     * @package deTube
     * @subpackage Page Template
     * @since deTube 1.1
     */
    ?>
    <section class="content">
    
    	<?php get_template_part('parts/page-title'); ?>
    
    	<div class="pad group">
    
    		<?php while ( have_posts() ): the_post(); ?>
    
    			<article <?php post_class('group'); ?>>
    
    				<?php get_template_part('parts/page-image'); ?>
    
    				<div class="entry themeform">
    <?php   $do_not_duplicate = array(); ?>
    <?php   $mosaics = new WP_Query('tag_id=1812&posts_per_page=4'); ?>
    <?php   while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
    <?php   $do_not_duplicate[] = $post->ID; ?>
    
    <?php echo get_template_part('content'); ?>
    <?php   endwhile; wp_reset_postdata(); ?>
    
    <br />
    
    <?php   $mosaics = new WP_Query( array( 'tag_id' => '2114', 'posts_per_page' => 4, 'post__not_in' => $do_not_duplicate ) ); ?>
    <?php   while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
    <?php   $do_not_duplicate[] = $post->ID; ?>
    <?php echo get_template_part('content'); ?>
    <?php   endwhile; wp_reset_postdata(); ?>
    
    <br />
    
    <?php   $mosaics = new WP_Query( array( 'tag_id' => '2112', 'posts_per_page' => 4, 'post__not_in' => $do_not_duplicate ) ); ?>
    <?php   while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
    <?php   $do_not_duplicate[] = $post->ID; ?>
    <?php echo get_template_part('content'); ?>
    <?php   endwhile; wp_reset_postdata(); ?>
    
    <br />
    
    <?php   $mosaics = new WP_Query( array( 'tag_id' => '2116', 'posts_per_page' => 4, 'post__not_in' => $do_not_duplicate ) ); ?>
    <?php   while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
    <?php   $do_not_duplicate[] = $post->ID; ?>
    <?php echo get_template_part('content'); ?>
    <?php   endwhile; wp_reset_postdata(); ?>
    <div class="clear"></div>
    				</div><!--/.entry-->
    
    			</article>
    
    			<?php if ( hu_is_checked('page-comments') ) { comments_template('/comments.php',true); } ?>
    
    		<?php endwhile; ?>
    
    	</div><!--/.pad-->
    
    </section><!--/.content-->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    What would I need to add to make it so that the 4 posts that are pulled from each category appear as thumbnail size?

    Thread Starter AchoronMH

    (@achoronmh)

    anyone know how to make featured image from
    <?php echo get_template_part('content'); ?>
    appear in thumbnail size?

    Use CSS to adjust the default image. Or copy content.php to your child theme and change the thumbnail size:

    <?php the_post_thumbnail('thumb-medium'); ?>

    Replace ‘thumb-medium’ with ‘thumb-standard’ or ‘thumb-small’.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Front Page – Archive page as home page’ is closed to new replies.