WordPress.org

Ready to get started?Download WordPress

Forums

Php file messing with wordpress loop. (2 posts)

  1. lj11
    Member
    Posted 5 years ago #

    ok, I know for sure that something in this code is messing with my single post loop. could someone please look it over and diagnose any problems? Thank you. [code]<!-- begin sidebar -->

    <div id="sidebar">

    <ul id="sidebarwidgeted">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>

    <li id="Search">
    <form method="get" id="search_form" action="<?php bloginfo('home'); ?>/">
    <input type="text" class="search_input" value="To search, type and hit enter" name="s" id="s" onfocus="if (this.value == 'To search, type and hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'To search, type and hit enter';}"/>
    <input type="hidden" id="searchsubmit" value="Search" /></form>

    <li id="About">
    <h2>About the Author</h2>
    <p>A young entrepreneur ranting, promoting, and discussing what interests him.</p>

    <?php if (is_single()) {
    if (get_the_category()) {
    foreach((get_the_category()) as $category) {
    echo '<h2>Related Articles</h2>'."\r\n

  2. ";
    query_posts('cat='.$category->cat_ID.'&limit=10');
    while (have_posts()) {
    the_post();
    ?>

    <?php
    }
    echo "

  3. \r\n";
    }
    }
    } ?> <?php endif; ?>
    <li id="Recent">
    <h2>Recent Articles</h2>

      <?php get_archives('postbypost', 10); ?>

    <li id="Categories">
    <h2>Categories</h2>

      <?php wp_list_cats('sort_column=name'); ?>

    <li id="Archives">
    <h2>Archives</h2>

      <?php wp_get_archives('type=monthly'); ?>

    </div>
    <!-- end sidebar -->[/code]

  • iridiax
    Member
    Posted 5 years ago #

    It's the code that starts with:

    <?php if (is_single()) {

    http://codex.wordpress.org/Template_Tags/query_posts

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags