Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:27:38+00:00 2026-06-07T18:27:38+00:00

Editor Note: original title of this Question – WordPress Template Changes Based on Template

  • 0

Editor Note: original title of this Question – “WordPress Template Changes Based on Template Code”

I have a page that reads the variable ( a single letter) from the url. The page then displays custom posts assigned to that letter (the letter is a custom field).

The problem is that the template assigned to the page is not doing the final rendering of the page.
It contains the following code:

<?php 
    $letter = $_GET['letter'];

    /*If there is no value returned then the loop defaults to searching for items beginning with 'A'*/ 
    if ( $letter=="" ) 
        $letter = 'A';

    /* The following <h1> needs to be outside of the loop */
?>
    <h1>Glossary Items Listed Under Letter "<?php echo $letter ?>"</h1> 

<?php 
    $loop = new WP_Query( 
                    array( 
                        'post_type' => 'glossary', 
                        'meta_key'=> 'first-letter', 
                        'meta_value' => $letter, 
                        'posts_per_page' => 10 ) 
                    ); 
?>

<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div class="glossarybody"> 
        <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    </div>
<?php endwhile; ?>

When that code is on the page the page displays the correct results ( a list of titles) but using the plugin Reveal Templates I see that the page is being rendered with page.php.
The correct template should be glossary-terms.php (I’ve tried using the filename terms.php in case the word glossary, the name of the custom post type involved, was causing a problem).

If I remove the above code and so that I’m left with a more or less static page that has some html, header, footer and sidebar, then the page renders using the correct template.
This suggests that something in the operation of WordPress is causing the template to change in the execution of the intial template.

I’d appreciate any pointers on what might be wrong with my setup and how to get the correct template to render the page.

UPDATE: I discovered that if I change the calling link I can get the correct template to render the page. For instance if the calling link ended in “…/terms?letter=A” and I changed it to “…./terms?letter=A/” then the page is rendered with the correct template.

UPDATE: regarding the previous comment. if I change the content of the field and the calling link to something other than the designated letter, say xya, then the whole process works correctly. So it would appear that something associated with this custom field is causing the designed template to be ignored.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:27:40+00:00Added an answer on June 7, 2026 at 6:27 pm

    There was not a problem with the function of WordPress.

    The problem arose because I was using a plugin to show the template being used and it appears that the plugin was malfunctioning.
    Looking at the body tag in the page source shows that the correct template is rendering the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/ if i have a table
[Editor's note: I have edited the title to try to make this useful to
Editor's note: This question was asked before Rust 1.0 was released and the syntax,
On the IOC Castle Windsor wiki [Editor's Note: After this question was written, the
I have an editor template with a dropdown: @Html.DropDownListFor(m => m.AdmissionState, new List<SelectListItem>() {
I have an editor which is in my window that contains a wrapping iframe
I have an usercontrol with fck editor for allowing user to add note in
Please consider this code: #include <iostream> template<typename T> void f(T x) { std::cout <<
I have a note editor control in my Windows Forms application: alt text http://img82.imageshack.us/img82/2033/tabtohiddencontrol.png
NOTE This was flagged as a potentially subjective question, but it is not subjective.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.