Make a page using the same layout as home page?

Hello!

My site main page: http://bit.ly/1SX5hRQ

Notice the Four columns on 'main news' posts on the front page?

I want to make a 'Xbox Art' page that will display posts posted in 'Xbox Art'.

But can show Four columns on the 'Xbox Art' page, the same layout as the main page?

Thanks!

  • Adam Czajczyk

    Hello Calum,

    Thanks for creating a thread and granting access to your site.

    It seems that we were quite close during the Live Chat today but the theme carries a "catch" :slight_smile: Here's a step by step guide on what to do:

    1. Access your site via FTP and go to "/wp-content/themes/THEME_FOLDER" folder
    2. Copy the "index.php" to "xbox-art.php" file (make sure that after that operation there are two files: original "index.php" and its copy named "xbox-art.php" -> use this name please!)
    3. Edit the "xbox-art.php" file and make following changes:

    a) replace this code

    <?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 Alizee
     */

    with this one:

    <?php
    /*
    Template Name: XBox Art
    */

    b) right below this line

    get_header(); ?>

    add this line

    <?php $query = new WP_Query( array( 'cat' => 14 ) ); ?>

    c) remove this line

    <?php get_sidebar(); ?>

    4. Edit the page in WordPress (the one you created for this listing, during live chat) and assign the "Xbox Art" template to it

    5. This actually is a tricky one as it requires editing theme's core file; The file to edit is "functions.php" file of your theme (it's in the same folder as template files mentioned above).

    - find this line

    if ( is_home() && get_theme_mod('home_layout') != 'one_col' )  {

    and replace it with this one

    if ( (is_home() OR is_page_template('xbox-art.php') && get_theme_mod('home_layout') != 'one_col' ))  {

    From now on your new page should show list of posts from category ID 14 using the same layout as your homepage.

    Please note however that the last change (in functions.php) file will have to be re-applied upon each theme's update.

    Let me know if it worked for you. Seem to be working on my setup but it's possible that some tiny additional tweaks may be necessary.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Calum!

    I accessed your site and I made some slight changes to the code I previously suggested. You will find them in both "xbox-art.php" file and "functions.php" file. Posts are now being displayed but surprisingly instead it's not keeping the "columns/masonry" layout now despite all the efforts.

    That said, I must admit I'm a bit stack for now so I'll ask my colleagues for some additional ideas. I'm sure this is relatively simple and I'm just overlooking something obvious here. Please keep an eye on this thread and I'll update it as soon as possible.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Calum!

    It seems that the theme is loading some specific stylesheet that's addressing only the home page so despite the same layout being used on another page these rules weren't applied. I copied and modified that CSS and put it into the "Appearance -> Custom CSS" box in you dashboard.

    Take a look at the page now, I think it looks like it was working now :slight_smile:

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.