• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Scottw

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • February 24, 2013 at 5:21 pm in reply to: Primary Sidebar Widget Getting Pushed Down #22598
    Scottw
    Member

    Thank you very much!

    I now understand how to interpet firebug  a little better too.

    I appreciate your help

    Scott

    February 5, 2013 at 10:03 pm in reply to: Trying to insert custom loop – News Child #18376
    Scottw
    Member

    Sorry, the code didn't display.. trying again

    <?php
    remove_action('genesis_loop', 'genesis_do_loop');
    //begin glossary code

    add_action( 'genesis_loop', 'custom_loop' );
    function custom_loop() {

    $first_char = $_GET["mychar"];// gets value of mychar in url
    //get all post IDs for posts beginning with letter equal to value of mychar in url , in title order,
    //display posts

    $postids=$wpdb->get_col($wpdb->prepare("
    SELECT ID
    FROM $wpdb->posts
    WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s
    ORDER BY $wpdb->posts.post_title",$first_char));

    if ($postids) {
    $args=array(
    'post__in' => $postids,
    'orderby' => 'title',
    'order' => 'ASC',
    'post_type' => 'post',//set this to custom post type if applicable
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'caller_get_posts'=> 1
    );

    $my_query = null;
    $my_query = new WP_Query($args);

    if( $my_query->have_posts() ) {
    ?>

    <h3> <?php echo 'Aviation Definitions beginning with the letter '. strtoupper($first_char);?>
    </h3><?php
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?> definition"><?php the_title();

    ?></a>
    <?php

    endwhile;

    } else
    {
    echo 'Sorry, no definitions found beginning with the letter '. strtoupper($first_char) . ', How about adding one?'; ?><?php
    }

    wp_reset_query(); // Restore global post data stomped by the_post().
    }
    } //end glossary

    genesis();

    ?>

     

    Functions.php file

    /* url paramter*/
    add_filter('query_vars', 'parameter_queryvars' );

    function parameter_queryvars( $qvars )// Function to be able to pick up mychar value at end of url
    {
    $qvars[] = 'mychar';
    return $qvars;
    }

     

     

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble