• I am trying to add custom post types to this theme and am specifically attempting to create a single-music-review.php file for this music-review custom post type.

    When I look up info on “the loop” the codex say the following:

    The loop starts here:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    But unfortunately this doesn’t quite delve into how the loop knows which posts to look for. I am specifically wondering what PHP functions I would use to get WordPress to find the specific post for that page if I’m using a permalink. For instance here is the page on my site:
    http://raveisking.danconia.us/music-review/review-glitch-mobs-love-death-immortality-lives-hype/

    I believe the codex says for get_the_id that it has to be within the loop, and same with get_the_title. So either the codex is wrong or there is some other function that parses the URL or something to that effect. Of course this will create an issue if I ever switch my permalink structure so I want to make sure I get this right before I start tampering away.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m sorry but as you appear to be using a commercial theme, you need to seek support from the theme’s developer/vendor. We do not support commercial products here.
    Try http://themeforest.net/user/holobest

    Thread Starter DatagoniaWeb

    (@datagoniaweb)

    Esmi, the question would be the same regardless of which theme I am using. How do loops typically figure out which post or posts to get? From the URL / URI? And do they always resort to the post ID or can they use the name (slug) in the URL?

    Hi there ,
    just try figure out this code below, it should help:

    <?php
    $args = array(
                  'post_type' => 'art',  //custom post type name
                  'orderby' => 'title',
    	      'order' => 'ASC'
    	      );
    $the_query = new WP_Query( $args );
    ?>
    <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>	
    
    <?php get_template_part( 'content', 'art' ); ?>
    
    <?php endwhile; endif; ?>

    This is part of copied page.php with changed posts section. File name in this case is art.php
    I hope it help

    Best Regards

    adriperaza

    (@adriperaza)

    Hi I am trying to post a video from youtube, try the video link does not work, try the code that does not work and gives youtube. What am I doing wrong?, When I go to put the picture shows me error screen

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[K-BOOM] How does loop typically find correct post?’ is closed to new replies.