Forum Replies Created

Viewing 6 replies - 61 through 66 (of 66 total)
  • Thread Starter dorich

    (@dorich)

    vtxyzzy

    Works perfectly – Thank You!

    Regarding default behavior, is that handled by putting conditionals around the code you gave me, something like:

    <?php $letter = $_GET['letter'];
    if ($letter=="") echo "No Entries Found!";
    else
    $loop = new WP_Query( array( 'post_type' => 'glossary', 'meta_key'=> 'first-letter', 'meta_value' => $letter, 'posts_per_page' => 10 ) ); ?>

    Thread Starter dorich

    (@dorich)

    vtxyzzy

    Thanks, that works – your help is very much appreciated.

    One more question if I could:

    Is there a way to pass a parameter into the query? The use for this would be avoid having to create 26 pages, one for each letter. The goal would be to have one page that is used for whatever letter was chosen.

    Stealing from a technique used in Expression Engine I was wondering if its possible to put the letter in the link url so that the page displaying any letter would be created from the URL.
    To illustrate the question:
    Assume that I have a page that lists all the letters of the alphabet.
    If I click on A the anchor tag associated with that letter is written in the code as
    https://www.example.com/glossary/A
    When you click on ‘A” then ‘A’ is passed to the template via the url and the list of entries for the letter A is created.

    Is this possible? If so where would I look to understand how to accomplish?

    Thanks

    Thread Starter dorich

    (@dorich)

    vtxyzzy – Thanks for your response.

    The following might(?) help:

    Looking at the code I’m using that produces the list of all the posts in a particular custom post type I wonder if there is a simple way of adding the custom field so that the query became something like
    <?php $loop = new WP_Query( array( 'post_type' => 'glossary', 'meta_key'='A', 'posts_per_page' => 10 ) ); ?>

    OR should it be something like
    <?php $loop = new WP_Query( array( 'post_type' => 'glossary'&'meta_key'='A', 'posts_per_page' => 10 ) ); ?>

    Or is the whole thing going to be more complicated because I have a different post type?

    thanks for the referral to the page on queries, that’s helpful although it doesn’t show any examples of combining the custom post with a custom field to form a query. However, I’ll use it as a starting place to do some more experiments.
    Thanks

    Thread Starter dorich

    (@dorich)

    Thanks for the feedback – that helped.

    Thread Starter dorich

    (@dorich)

    Thanks

    Thread Starter dorich

    (@dorich)

    Thanks, I appreciate the feedback.

Viewing 6 replies - 61 through 66 (of 66 total)