• Resolved klint01

    (@klint01)


    I want to be able to provide two options for the user when viewing archive postings. One view would be more gallery style (multiple smaller posts on one page in columns and rows). The other view would be the standard stacked posts (one column).

    I have setup tag.php file to show gallery and archive.php to show standard. By default, if the user clicks on a tag in a posting, they will see the tag.php gallery view.

    How can I provide an option to bypass the tag.php and take the user directly to archive.php, if the users chooses to view the page in standard mode?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The code I’m posting is not specifically related to what you are asking about. It shows how to call in different single post display templates under different conditions.

    I suggest you adapt this technique to work with your requirements. The principle will be the same, just the application is quite different.

    The entire contents of single.php are replaced with this IF – ELSE logic. The contents of the existing single.php are moved into the subsidiary template files as required.

    <?php $post = $wp_query->post;
      if ( in_category('1') ) {
      include(TEMPLATEPATH . '/single1.php');
      } elseif ( in_category('2') ) {
      include(TEMPLATEPATH . '/single2.php');
      } else {
      include(TEMPLATEPATH . '/single_other.php');
      } ?>

    Hopefully this will help you

    Thread Starter klint01

    (@klint01)

    Thanks for the information. I will have to look into this approach.

    Thread Starter klint01

    (@klint01)

    This concept worked perfectly. I had to learn how to pass a specific variable and check it but in the end it came out great.

    Thanks!

    This topic can be closed.

    glad to hear it.

    There is a place where you as the originator can mark this topic as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can you bypass Template Hierarchy?’ is closed to new replies.