0
votes

I am using a wordpress theme. The default homepage is the latest posts. In my theme its the home.php which is the content of the default homepage. Now i want to have a static homepage and blog page. I have created a new page called "Home" and set it as homepage. So the previous default homepage content is not coming up in my new Home page. My question is how can i add those default homepage content to this new Home page ? I dont want to change the page.php template as it would change all the pages then. I want to change this particular "Home" page and set it as homepage with the previous default homepage content. Can someone help me please ?

Here is default homepage code

<?php get_header(); ?>
<?php if ( get_option('modest_quote') == 'on' ) { ?>
    <div id="quote">
        <p id="quote-1"><span class="tagline-quote">&ldquo;</span><?php echo get_option('modest_quote_one'); ?><span class="tagline-quote">&rdquo;</span></p>
        <p id="quote-2"><?php echo get_option('modest_quote_two'); ?></p>
    </div> <!-- end #quote -->
<?php } ?>

<?php if ( get_option('modest_featured') == 'on' ) get_template_part('includes/featured'); ?>

<?php if ( get_option('modest_blog_style') == 'false' ){ ?>
    <div id="blurbs" class="clearfix">
        <?php 
            $blurbs_number = get_option('modest_use_third_page') == 'on' ? 3 : 2;
            if ( get_option('modest_use_third_page') == 'on' ) $blurbs_number = 3; 
        ?>
        <?php for ($i=1; $i <= $blurbs_number; $i++) { ?>
            <?php query_posts('page_id=' . get_pageId(html_entity_decode(get_option('modest_home_page_'.$i)))); while (have_posts()) : the_post(); ?>
                <?php 
                    global $more; $more = 0;
                ?>
                <div class="blurb<?php if ( $i == 3 ) echo ' last'; ?>">
                    <h3 class="title"><?php the_title(); ?></h3>
                    <?php the_content(''); ?>
                </div> <!-- end .blurb -->
            <?php endwhile; wp_reset_query(); ?>
        <?php } ?>

        <?php if ( $blurbs_number == 2 ) { ?>
            <div class="blurb last">
                <h3 class="title"><?php esc_html_e('Examples of Our Work','Modest'); ?></h3>
                <?php query_posts("showposts=".get_option('modest_work_number')."&cat=".get_cat_ID(get_option('modest_work_cat')));
                    if (have_posts()) : while (have_posts()) : the_post(); ?>
                        <?php 
                        $width = 56;
                        $height = 56;
                        $titletext = get_the_title();

                        $thumbnail = get_thumbnail($width,$height,'item-image',$titletext,$titletext,true,'Work');
                        $thumb = $thumbnail["thumb"];
                        $fancybox_title = get_post_meta($post->ID,'Customtitle',true) ? get_post_meta($post->ID,'Customtitle',true) : get_the_title(); ?>
                        <div class="thumb">
                            <a rel="gallery" title="<?php echo esc_attr($fancybox_title); ?>" href="<?php echo esc_attr($thumbnail['fullpath']); ?>" class="fancybox">
                                <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, 'item-image'); ?>
                                <span class="overlay"></span>
                                <span class="zoom-icon"></span>
                            </a>
                        </div>  <!-- end .thumb -->
                    <?php 
                    endwhile; endif; 
                wp_reset_query(); ?>
            </div> <!-- end .blurb -->
        <?php } ?>
    </div> <!-- end #blurbs -->
<?php } else { ?>
    <div id="left-area">
        <?php get_template_part('includes/entry','home'); ?>
    </div>  <!-- end #left-area -->
    <?php get_sidebar(); ?>
<?php } ?>
3
can you add some code of your new template? - Dreamm
I have added the code - Amit Pal
If all you want is to change the name of the "home" page, which is "index.php", maybe one Directoryindex directive at .htaccess will do it. - Felipe Alameda A

3 Answers

0
votes

Plz try it will give your answer

Plz make template of home page and asign template to that page from admin panel and plz put below code at the top of template page which you created new

/*
Template Name: Home Page
The template for displaying Home
 */

select the home page template in your wordpress page that you create in admin panel

0
votes

You can create home page template for separate home page design. please refer following link for how to make template in WordPress.

https://codex.wordpress.org/Page_Templates

and then in your home page edit mode in admin panel please select template.

helpful functions for getting content,featured image and all that you can use functions like listed bellow.

the_content();
get_the_post_thumbnail();
get_permalink();
get_excerpt()

etc. please html remain same in template and just put php code where you want image content etc.

0
votes

Create and use the front-page.php template file for this task! Simply dump home.php's code into front-page.php.

If it exists, the front-page.php template file is used on the site's front page regardless of whether 'Settings > Reading ->Front page displays' is set to "A static page" or "Your latest posts," the Theme will need to account for both options, so that the site front page will display either a static page or the blog posts index.

Take a look at this official WordPress Documentation https://codex.wordpress.org/Creating_a_Static_Front_Page