Archive template

Hi!

We are using x-theme integrity.
We want to customize the archive template.

according to this post : https://theme.co/apex/forums/topic/archive-integrity-page-customize/

we duplicated x/index.php into x-child/, and renamed it “archive.php”.
Then put a big title saying “This is the archive page” but when we reload, we do not see the title. In order words, is not taking archive.php as the page template.

What are we doing wrong?

No staging site to test, only local.

This is the content of archive.php :

<?php

// =============================================================================
// INDEX.PHP
// -----------------------------------------------------------------------------
// Handles output of pages and posts if a more specific template file isn't
// present. Must be present for theme to function properly.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's index, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "wp-index.php," where you'll be able to find the
// appropriate output.
// =============================================================================

?>

<h1>this is the archive</h1>

<?php x_get_view( x_get_stack(), 'wp', 'index' ); ?>

Note: we duplicated some archives from x/ to /x-child, because we wanted to customize the structure of the single page, for example…

x-child/framework/views/global/_content-the-excerpt.php
x-child/framework/views/integrity/_content-post-header.php
x-child/framework/views/integrity/content.php
x-child/framework/views/integrity/wp-index.php
x-child/framework/views/integrity/wp-single.php

However, we don’t think this has something to do with the fact that archive.php is not loading.

Please help!

Update:

Archive.php is working for category archive, but not for only archive (without category)

Does that shed some light ?

If it helps, we created a page, and set it as “Posts page” under Settings > Reading.

Hi there,

Thanks for writing in.

Please provide your site’s URL and admin login credentials in a secure note and I’ll check what’s happening. I couldn’t provide any recommendation yet as I’m not sure about the cause of the said issue.

Thanks!

Hi Rad,

I added site url and log in credentials on the preovious comment as a secure note.

What we want to do, is to be able to edit the archive page, and the individual (single) page templates on the x-child theme. But we don’t understand very well the templates stucture, since we are using integrity, and some parts of the templates are global, and other not…

Is not as simple as editing a simple wordpress theme…

Hi there,

To change the Archive template please copy the file below:

wp-content/themes/x/framework/views/integrity/wp-index.php

to:

wp-content/themes/x-child/framework/views/integrity/

You will need to create necessary folders in the Child Theme to match the exact hierarchy above.

For the blog single page please copy the file below:

wp-content/themes/x/framework/views/integrity/wp-single.php

to:

wp-content/themes/x-child/framework/views/integrity/

You will need to create necessary folders in the Child Theme to match the exact hierarchy above.

In the PHP code inside the files above whenever you see a statement like this:

<?php x_get_view( 'global', '_index' ); ?>

That means you need to search for a file:

wp-content/themes/x/framework/views/global/_index.php

So the GLOBAL is the name of the folder and _INDEX.PHP is the name of the file.
Basically the content of the _index.php will be replaced with the function above.

I mentioned the above so that you can follow the templating system in case you need to change a part of the page which is inside another sub-file like the example above.

For more information:

Thank you.

Hi Christopher,

Thank you ver much for the explanation.

However, as I understand, “index.php” is the outermost general template, Unless there are more specific pages, for let’s say , category, or single.

Your suggestion is to use wp-index.php for both, archive and single ?

In a normal wordpress theme, “archive.php” would be used for the archive page, and “single.php” would be used for the single page…

I don’t want to use wp-index.php for everything…

Please she the template hierarch y : https://developer.wordpress.org/files/2014/10/wp-hierarchy.pnghttps://developer.wordpress.org/files/2014/10/wp-hierarchy.png

How do I set up a “archive.php” and “single.php”" for integrity ?

Hi There,

You can create 2 files archive.php and single.php in your child theme with the following code:

  • x-child/archive.php
<?php

// =============================================================================
// ARCHIVE.PHP
// -----------------------------------------------------------------------------
// Index page output for Integrity.
// =============================================================================

?>

<?php get_header(); ?>

  <div class="x-container max width offset archive">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php x_get_view( 'global', '_index' ); ?>

    </div>

    <?php get_sidebar(); ?>

  </div>

<?php get_footer(); ?>
  • x-child/single.php
<?php

// =============================================================================
// SINGLE.PHP
// -----------------------------------------------------------------------------
// Single post output for Integrity.
// =============================================================================

$fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );

?>

<?php get_header(); ?>
  
  <div class="x-container max width offset single">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php while ( have_posts() ) : the_post(); ?>
        <?php x_get_view( 'integrity', 'content', get_post_format() ); ?>
        <?php x_get_view( 'global', '_comments-template' ); ?>
      <?php endwhile; ?>

    </div>

    <?php if ( $fullwidth != 'on' ) : ?>
      <?php get_sidebar(); ?>
    <?php endif; ?>

  </div>

<?php get_footer(); ?>

Let us know how it goes!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.