This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

smkorby

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • in reply to: post grid order by #16825
    smkorby
    Participant

    You. Are. Awesome. Thank you.

    in reply to: post grid order by #16817
    smkorby
    Participant

    Thank you for explaining, it’s mostly working now. Last question, I promise. 🙂

    What is it about this:

    function my_custom_posts_query( $query, $args ){
    	if( $args['query'] == 'my-custom-query' ){
    		$query = array( 
    			'order'     => 'ASC',
                            'meta_key'  => 'orderbydate',
                            'orderby'   => 'meta_value_num'
    		);
    	}
    	return $query;
    }
    add_filter( 'themeblvd_posts_args', 'my_custom_posts_query', 10, 2 );

    that only shows the first 5 posts?

    [post_grid columns=”3″] shows all posts. If I add query=”my-custom-query” to the shortcode, only the next 5 posts show. I have orderbydate set in all posts.

    This is in the calendar post now:
    [post_grid query=”my-custom-query”]
    [post_grid columns=”3″ rows=”99″]

    in reply to: post grid order by #16588
    smkorby
    Participant

    Thank you. I’m sure the answer is in there, but I’m not connecting all of the dots.

    Child theme fuctions.php has this:

    /**
     * Custom query for post lists/post grids
     */
    function my_custom_posts_query( $query, $args ){
    	if( $args['query'] == 'grid_slider' ){
    		$query = array( 
                'order'     => 'ASC',
                'meta_key' => 'orderbydate',
                'orderby'   => 'meta_value_num' );
    	}
    	return $query;
    }
    add_filter( 'themeblvd_posts_args', 'my_custom_posts_query', 10, 2 );
    ?>

    Each post in the Event category has a custom field called “orderbydate” with the date of the event entered as “20140514”. This is what I am trying to order by.

    http://creativelyuncorked.com/calendar-2/ has this shortcode. Orderby does not work:
    [post_grid category_name=”event” columns=”3″ rows=”0″ orderby=”orderbydate” order=”ASC” offset=”0″]

    I realize now that this probably should have been done with hooks, but before any of this, I had the content-grid.php in the child theme set to:

    <?php
    /**
     * The template used for displaying posts in a grid.
     */
    $excerpt = themeblvd_get_option( 'post_grid_excerpt', null, 'hide' );
    $button = themeblvd_get_option( 'post_grid_button', null, 'hide' );
    ?>
    <div class="grid-item column <?php echo themeblvd_get_att('size'); ?><?php if( themeblvd_get_att('counter') % themeblvd_get_att('columns') == 0 ) echo ' last'; ?>">
    	<div class="article-wrap">
    		<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<div class="entry-content<?php if( $excerpt == 'show' && $button == 'show' ) echo ' has_elements'; ?>">
    
    				<div class="cdate"><?php echo get_post_meta($post->ID,'when',true) ?></div>
    				<div class="soldout"><?php echo get_post_meta($post->ID,'soldout',true) ?></div>
    
    				<?php themeblvd_the_post_thumbnail( themeblvd_get_att('location'), themeblvd_get_att('size') ); ?>
    				<?php if( 'show' == themeblvd_get_option( 'post_grid_title', null, 'show' ) ) : ?>
    					<h2 class="entry-title"><?php themeblvd_the_title(); ?></h2>
    				<?php endif; ?>
    				<?php if( 'show' == $excerpt ) : ?>
    					<?php the_excerpt(); ?>
    				<?php endif; ?>
    				<?php if( 'show' == $button ) : ?>
    					<p><?php echo themeblvd_button( themeblvd_get_local( 'read_more' ), get_permalink( get_the_ID() ), 'default', '_self', 'small', 'read-more', get_the_title( get_the_ID() )  ); ?></p>
    				<?php endif; ?>
    			</div><!-- .entry-content -->
    		</article><!-- #post-<?php the_ID(); ?> -->
    	</div><!-- .article-wrap (end) -->
    </div><!-- .grid-item (end) -->

    None of these things is ordering by date. What am I missing?

Viewing 3 replies - 1 through 3 (of 3 total)