• 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

My very simple custom loop isn't working. Help!

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

Community Forums › Forums › Archived Forums › Design Tips and Tricks › My very simple custom loop isn't working. Help!

This topic is: resolved
  • This topic has 3 replies, 2 voices, and was last updated 10 years, 2 months ago by Susan.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • November 21, 2012 at 12:23 pm #1158
    theMikeD
    Participant

    I am trying to modify the loop as I have found here
    http://designsbynickthegeek.com/tutorials/genesis-explained-framework-actions
    and have created this (to show posts from a custom post type only):

    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'custom_loop');
    function custom_loop () {
    global $query_string, $post;
    $new_args = array(
    'post_type' => 'bc_featured_entries',
    );
    $args = wp_parse_args($query_string, $new_args);
    genesis_custom_loop($args);
    }
    genesis();

    which shows nothing. Yet this:

    $togs = get_posts(
    array(
    'post_type' => 'bc_featured_entries',
    )
    );
    if ($togs) {
    foreach( $togs as $tog ) {
    echo get_the_title($tog->ID);
    }
    }

    Shows the title for the custom post, as expected. What am I doing wrong?

    December 28, 2012 at 12:37 pm #7938
    Susan
    Moderator

    It's been a while since you posted this. Are you still having an issue? If so, please provide a link to your site. Thanks!

    January 5, 2013 at 5:07 pm #9810
    theMikeD
    Participant

    Hi Susan,

    I got it sorted out:

    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'custom_featured_loop');

    function custom_featured_loop (  ) {

    global $post;global $wp_query;

    $args = array(
    'paged' => get_query_var( 'paged' ),
    'post_type' => 'bc_featured_entries',
    );

    $wp_query = new WP_Query( $args );

    genesis_do_loop();
    }

    January 5, 2013 at 5:12 pm #9812
    Susan
    Moderator

    Thanks for checking back in. I'm glad you got your issue resolved!

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘My very simple custom loop isn't working. Help!’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 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