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

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

This topic is: resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Susan 1 year, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1158

    theMikeD
    Participant
    Post count: 20

    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?

    • This topic was modified 2 years ago by  theMikeD.
    • This topic was modified 2 years ago by  theMikeD.
    #7938

    Susan
    Moderator
    Post count: 9544

    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!


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #9810

    theMikeD
    Participant
    Post count: 20

    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();
    }

    #9812

    Susan
    Moderator
    Post count: 9544

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


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered 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.