Graphene Child with Sidebar and Widgets

  • puffin

    #6236

    I am using WordPress 3.4.2 with the Graphene Theme 1.8.2 with a Child Theme. I have just one sidebar on the RHS.

    http://www.birminghamchoralunion.org.uk/wordpress/

    I have a static front page but on all other pages I have up to 3 widgets that I can have (list-category-posts, text, sub-pages). These all work perfectly as long as I use the Default Template for the pages.

    As soon as I use any custom template (placed in wp-content/themes/graphene-child) the text and sub-pages widgets don’t show. The list-category-post widget continues to show.

    http://www.birminghamchoralunion.org.uk/wordpress/concerts/

    The text widget is supposed to show the link that I have now coded to show above the posts for this page.

    Can anyone help with this please?

    puffin

    #32603

    Here is the code for the page template

    <?php
    /**
    * Template Name: future_concerts
    */
    get_header(); ?>
    <?php
    /* Run the loop to output the pages.
    * If you want to overload this in a child theme then include a file
    * called loop-page.php and that will be used instead.
    */
    the_post();
    get_template_part( 'loop', 'page' );

    /* Check if the user selects specific category for the templated page */
    $cats = 'concerts'; // Change these category SLUGS to suit your use.
    // Display the posts from the category with a post_date in the future
    $args= array(
    'category_name' => $cats
    );
    // The Query
    // $the_query = new WP_Query( $args );
    function filter_where($where = '') {
    $where .= " AND post_date >= '" . date('Y-m-d') . "'";
    return $where;
    }
    add_filter('posts_where', 'filter_where');
    query_posts($query_string . 'category_name=concerts&order=ASC');

    $my_query = new WP_Query('category_name=concerts&order=ASC');

    // The Loop
    // while ( $the_query->have_posts() ) : $the_query->the_post();
    while ($my_query->have_posts()) : $my_query->the_post();
    // echo '<li>';
    // the_title();
    // the_content();
    get_template_part( 'loop', 'index' );
    // echo '</li>';
    endwhile;
    /* Posts navigation. */
    graphene_posts_nav();
    // Reset Post Data
    wp_reset_postdata();
    ?>
    <?php get_footer(); ?>
    Mod

    Kenneth John Odle

    #32604
    Quote:
    As soon as I use any custom template

    Why are you using this? What is the end-goal that you are trying to achieve? There may be an easier way to accomplish it without resorting to this method.

    puffin

    #32605

    It is the only way that I can see to have future concerts on one page and past concerts on another. I am running no-future-posts because I want one of the future concerts on the header slider and can’t see any other way to do that either.

    I tried using list-category-posts but can’t see how to make that work with date selection either. Also that method doesn’t seem to show the gallery.

    Do you have any other suggestions?

    puffin

    #32606

    Fixed !!!

    I removed this line and it works!!

    query_posts($query_string . 'category_name=concerts&order=ASC');
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.