Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1406791

    blue928
    Participant

    There are many forum entries where X Customer Support says “all you have to do is create an archive.php page and put it in your child theme and it will work.”

    So, I created an archive.php page and it’s located at x-child/archive.php

    But this does not work for me. As soon as I add the archive.php page, I get an include error:

    Failed opening ‘/home/tbadmin/www/demo/httpdocs/beokinawa/httpdocs/wp-content/themes/x-child/index.php’

    So, I copied x/index.php to x-child/index.php and now the page loads. But, index.php calls wp-index.php, which in turn calls _index.php. And now the output from the original Renew archive page shows regardless of what I have in my archive.php file.

    What am I doing wrong? You can also see in the screenshot that I have category.php as well. No matter what I add, the site breaks.

    If X is following wordpress template hierarchy best practices, why would category.php and archive.php be skipped and X try to call index.php? https://developer.wordpress.org/themes/basics/template-hierarchy/ (It should never make it to step 5 since I have both category.php and archive.php in place)

    Thanks!

    #1407204

    ianizaguirre
    Participant

    why do you want to do that?

    #1407206

    blue928
    Participant

    because I want to create a custom archive.php page that looks different than the default view X provides.

    #1407254

    Friech
    Moderator

    Hi There,

    The error above is pointing on a index.php file, would you mind removing that file from the child theme?

    Check your category.php file by just having this:

    <?php get_header(); ?>
    <?php echo '<h1 class="center-text">This is a category page</h1>'; ?>
    <?php get_footer(); ?>

    And the archive.php file with this:

    <?php get_header(); ?>
    <?php echo '<h1 class="center-text">This is an archive page</h1>'; ?>
    <?php get_footer(); ?>

    If you see those strings on the category and archive pages, then you know that the archive.php and category.php template works.

    Regretfully editing the archive page (custom template) is outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding.

    #1407294

    blue928
    Participant

    Sorry, but I don’t think you looked at my screenshot or understood my question. Also, I’m not asking for development help.

    I’ve installed a fresh copy of X and Cornerstone. I’m following the many instructions in the forums to add archive.php to my child theme. If you will please look at my screen shot you’ll see they are properly in place. You will also see that there is no index.php file.

    I also added your code to both category.php and archive.php. It actually doesn’t matter what I put here. If I add any file that follows wordpress best practices naming conventions, I still get the same issue. What could be causing this?

    #1407667

    Lely
    Moderator

    Hi There,

    Would you mind providing us with login credentials so we can take a closer look on your setup? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    You can see this screencast as guide:http://screencast-o-matic.com/watch/cbeoim6AmD

    This is the sample content of archive.php:

    <?php get_header(); ?>
    
      <div class="x-container max width main">
    
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
                 <h1>Custom Archive Template Sample</h1>
    
          </div>
    
          <?php get_sidebar(); ?>
    
        </div>
      </div>
    
    <?php get_footer(); ?>

    Can you try that and see if it works for you? If not we will check using your FTP credentials.

    #1411241

    blue928
    Participant

    Hello Lely, thank you for taking the time to investigate my issue. After many hours of research, we can confirm that this is a bug – an incompatibility between X theme and WPML. Because X states that it is WPML compatible, we’d like to submit this as a bug report. We can confirm that this is repeatable. Here are the details:

    I am trying to:
    Add archive.php or category.php to x-child theme for the X template to override default styling provided by the parent theme.

    URL of (my) website where problem appears:
    http://dev.bluepresley.com/testxwpml/category/uncategorized/

    I expected to see:
    A working page

    Instead, I got:
    a broken page, and this error, in Apache error.log:

    [Fri Mar 17 12:30:21.839412 2017] [:error] [pid 19522] [client ] PHP Warning: include(): Failed opening ‘/home/bluepresley/www-dev/testxwpml/wp-content/themes/x-child/index.php’ for inclusion (include_path=’.:/usr/share/php’) in /home/bluepresley/www-dev/testxwpml/wp-includes/template-loader.php on line 74, referer: http://dev.bluepresley.com/testxwpml/wp-admin/edit-tags.php?taxonomy=category

    Steps to duplicate the issue:
    1) install a new version of wordpress
    2) install X theme
    3) install x-child theme, activate
    4) Add archive.php to child theme – test that it works by viewing any category listing page (and it does work)
    5) enable newest version of WPML
    6) reload category page to see the problem. It’s at this time that we get the error above.
    7) I have confirmed that this happens only with X and X-child theme. All other themes and child themes work as expected

    Notes: I’ve cross listed this issue with WPML support forums as well. https://wpml.org/forums/topic/adding-archive-php-to-a-child-theme-throws-errors-when-using-the-x-theme/

    The earlier timestamped attached image shows archive.php in place and WPML activated (the error). The second is with archive.php in place and WPML deactivated.

    I have created a test server with only X, Cornerstone and WPML installed. please let me know if you would like access to both the website and server.

    #1411865

    Rad
    Moderator

    Hi there,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    I’d like to directly test it too.

    Thanks!

    #1412129

    blue928
    Participant
    This reply has been marked as private.
    #1412599

    Rad
    Moderator

    Hi there,

    I added the fix through child theme’s functions.php. Please check now.

    Cheers!

    #1412803

    blue928
    Participant

    Thank you Rad, this seems to be working. Could you elaborate just a bit on what was happening? Will we need to apply this to our other WPML sites or is this something that will be addressed in upcoming updates for X? We’re testing pretty thoroughly and will report back if we encounter any more issues. Thanks!

    #1413280

    Rad
    Moderator

    Hi there,

    If you’ll use custom archive template and the issue is there, then you’ll have to do the same fix too.

    We included fixes on X theme to properly integrate it with WPML, the recent WPML versions caused to issue an issue with search templates (eg. archive template). But seems like that fix has different or reversed effect on your site, so I added the code that will remove the integration.

    Thanks.

    #1419937

    ianizaguirre
    Participant

    @blue928

    If you still need help I have instructions on how to do this but I show you how to replace it using “the grid” plugin that comes with X -theme. You can read how I did it here : http://izaguir.re/how-to-replace-x-theme-index-pages-using-the-grid-plugin/

    #1420380

    Rad
    Moderator

    Thanks for sharing Ian!