• valwordpress

    (@messiervaleriegmailcom)


    Hi, can you tell me how to add post in the galery style exactly like on the home page on other pages on the menu. Exactly like the live demo of the theme. I’m sure it’s very simple. Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • AddWeb Solution

    (@addweb-solution-pvt-ltd)

    You have to create custom template file for your requirement.
    Follow the below steps:

    1. Create a file (custom-template.php) in your theme folder (wp-content/themes/fifteen) and past below code:

    <?php 
      /*
        Template Name: Custom Template
      */
    get_header(); ?>
    
    <div id="primary-main" class="content-area col-md-12">
        <main id="main" class="site-main row container" role="main">
        <?php 
          query_posts( array(
          'post-type','post',
          'orderby' => 'date',
          'order' => 'DESC', ) );
        ?>
        <?php if ( have_posts() ) : ?>
    
          <?php /* Start the Loop */ $ink_count = 0; $ink_row_count=0 ?>
          <?php while ( have_posts() ) : the_post(); 
             if ($ink_count == 0 ) {echo "<div class='row-".$ink_row_count." row'>";}
          ?>
          
    
            <?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', 'home' );
            ?>
    
          <?php 
            if ($ink_count == 2 )
              {
                echo "</div>";
                $ink_count=0;
                $ink_row_count++;
              }
            else {  
              $ink_count++;
            }
            
            endwhile; 
          ?>
    
          <?php fifteen_pagination(); ?>
    
        <?php else : ?>
    
          <?php get_template_part( 'no-results', 'index' ); ?>
    
        <?php endif; ?>
    
        </main><!-- #main -->
      </div><!-- #primary-main -->
    
    <?php get_sidebar('footer'); ?>
    <?php get_footer(); ?>

    2. Go to your page (Dashboard > Pages > Your Page) and select template ‘Custom-Template’ from page attributes at right side.

    Screenshot Link -> https://pageshot.net/images/4dbd5402-bdb3-4207-8d0a-ec7fb4e45c43

    Thread Starter valwordpress

    (@messiervaleriegmailcom)

    Great, it’s working well !!! Thank you very much!
    By any chance, do you khow how to display post only for a specific page.
    Thanks!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Posts in other pages than the home page’ is closed to new replies.