Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • since 3.1 the way you query taxonomy has changed so for anyone stumbling across this code like i did today here is the amended code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    enjoy

    S

    Thread Starter sebashton

    (@sebashton)

    @martinleclercq my code now looks like this:

    $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 ;
    $args = array( 'order' => 'DESC', 'orderby' => 'date', 'paged' => $paged, 'post_type' => 'issue', 'posts_per_page' => 1 );
    
    query_posts( $args );
    
    if (have_posts()) :
    
    while ( have_posts() ) : the_post();
    ...
    Thread Starter sebashton

    (@sebashton)

    @adeptris && @martinleclercq

    The issue is with the use of wp_query

    replace that with query_posts and it works like a charm.

    Thread Starter sebashton

    (@sebashton)

    Hi alchymyth,

    The previous_posts_link/next_posts_link don’t recognise that there are posts to paginate to, so they don’t show up.

    Yes the page number shows up but they don’t rely on the paginated data.

    Link

    In the first instance WP PagNavi paginates you though the results set returned from you wp_query but in the single post/page it paginates you through the pages of the post/page. So its going exactly what it should, Is this not the behaviour you want?

    If you want to navigate to the next/previous post in the category have a look at:

    Both of these are intended for use within single posts/pages loop to navigate to the next/previous posts

    I was after an answer to exactly the same issue – well to get the events list. so i solved it myself.

    I altered the list.php template and saved it as a page template in my root directory.

    Below is the code i used so you can literally copy and paste it if you want. You may want to alter the position of the post content loop to before or after the calander, but thats your choice.

    NB. I deleted the function to swap between list and calender so if you want it copy it from list.php in views

    hope this helps,

    Seb

    <?php
    /*
    Template Name: eventlist-in-page
    */
    ?>
    <?php
    	global $spEvents;
    	$spEvents->loadDomainStylesScripts();
    
    	get_header();
    ?>
    	<div id="tec-content" class="upcoming">
    		<div id='tec-events-calendar-header' class="clearfix">
    			<h2 class="tec-cal-title"><?php _e('Calendar of Events', $spEvents->pluginDomain) ?></h2>
    		</div><!--#tec-events-calendar-header-->
    
    		<div id="tec-events-loop" class="tec-events post-list clearfix">
    		<?php $cal_query = new WP_Query('category_name=Events'); ?>
    		<?php while ($cal_query->have_posts()) : $cal_query->the_post(); ?>
    
    				<div id="post-<?php the_ID() ?>" class="tec-event post clearfix<?php echo $alt ?>">
    							    <div style="clear:both;"></div>
    							        <?php if ( is_new_event_day() ) : ?>
    					<h4 class="event-day"><?php echo the_event_start_date( null, false ); ?></h4>
    							        <?php endif; ?>
    						<?php the_title('<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
    					<div class="entry-content tec-event-entry">
    						<?php the_excerpt() ?>
    					</div> <!-- End tec-event-entry -->
    
    					<div class="tec-event-list-meta">
    		              <table cellspacing="0">
    		                  <tr>
    		                    <td class="tec-event-meta-desc"><?php _e('Start:', $spEvents->pluginDomain) ?></td>
    		                    <td class="tec-event-meta-value"><?php echo the_event_start_date(); ?></td>
    		                  </tr>
    		                  <tr>
    		                    <td class="tec-event-meta-desc"><?php _e('End:', $spEvents->pluginDomain) ?></td>
    		                    <td class="tec-event-meta-value"><?php echo the_event_end_date(); ?></td>
    		                  </tr>
    		                  <?php
    		                    $venue = the_event_venue();
    		                    if ( !empty( $venue ) ) :
    		                  ?>
    		                  <tr>
    		                    <td class="tec-event-meta-desc"><?php _e('Venue:', $spEvents->pluginDomain) ?></td>
    		                    <td class="tec-event-meta-value"><?php echo $venue; ?></td>
    		                  </tr>
    		                  <?php endif; ?>
    		                  <?php
    		                    $phone = the_event_phone();
    		                    if ( !empty( $phone ) ) :
    		                  ?>
    		                  <tr>
    		                    <td class="tec-event-meta-desc"><?php _e('Phone:', $spEvents->pluginDomain) ?></td>
    		                    <td class="tec-event-meta-value"><?php echo $phone; ?></td>
    		                  </tr>
    		                  <?php endif; ?>
    		                  <?php if (tec_address_exists( $post->ID ) ) : ?>
    		                  <tr>
    							<td class="tec-event-meta-desc"><?php _e('Address:', $spEvents->pluginDomain); ?><br />
    							<?php if( get_post_meta( $post->ID, '_EventShowMapLink', true ) == 'true' ) : ?>
    								<a class="gmap" href="<?php event_google_map_link(); ?>" title="Click to view a Google Map" target="_blank"><?php _e('Google Map', $spEvents->pluginDomain ); ?></a>
    							<?php endif; ?></td>
    							<td class="tec-event-meta-value"><?php tec_event_address( $post->ID ); ?></td>
    		                  </tr>
    		                  <?php endif; ?>
    		                  <?php
    		                    $cost = the_event_cost();
    		                    if ( !empty( $cost ) ) :
    		                  ?>
    	 		              <tr>
    							<td class="tec-event-meta-desc"><?php _e('Cost:', $spEvents->pluginDomain) ?></td>
    							<td class="tec-event-meta-value"><?php echo $cost; ?></td>
    						 </tr>
    		                  <?php endif; ?>
    		              </table>
    					</div>
    					<div style="clear:both;"></div>
    				</div> <!-- End post -->
    				<div class="tec-events-list content_footer"></div>
    	<?php $alt = ( empty( $alt ) ) ? ' alt' : '';?>
    		<?php endwhile; // posts ?>
    
    		</div><!-- #tec-events-loop -->
    		<div class="tec-nav" id="tec-nav-below">
    
    			<div class="tec-nav-previous"><?php
    			// Display Previous Page Navigation
    			if( events_displaying_upcoming() && get_previous_posts_link( ) ) : ?>
    				<?php previous_posts_link( '<span>&laquo; Previous Events</span>' ); ?>
    			<?php elseif( events_displaying_upcoming() && !get_previous_posts_link( ) ) : ?>
    				<a href='<?php echo events_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', $spEvents->pluginDomain ); ?></span></a>
    			<?php elseif( events_displaying_past() && get_next_posts_link( ) ) : ?>
    				<?php next_posts_link( '<span>&laquo; Previous Events</span>' ); ?>
    			<?php endif; ?>
    			</div>
    
    			<div class="tec-nav-next"><?php
    			// Display Next Page Navigation
    			if( events_displaying_upcoming() && get_next_posts_link( ) ) : ?>
    				<?php next_posts_link( '<span>Next Events &raquo;</span>' ); ?>
    			<?php elseif( events_displaying_past() && get_previous_posts_link( ) ) : ?>
    				<?php previous_posts_link( '<span>Next Events &raquo;</span>' ); // a little confusing but in 'past view' to see newer events you want the previous page ?>
    			<?php elseif( events_displaying_past() && !get_previous_posts_link( ) ) : ?>
    				<a href='<?php echo events_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', $spEvents->pluginDomain); ?></span></a>
    			<?php endif; ?>
    			</div>
    
    		</div>
    <div class="clear"></div>
    
    <!--
    	START Page lopp
    -->
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div>
    			<?php
    			/*
    				post content
    			*/
    			    the_content();
    
    			?>
    			<?php edit_post_link('Edit', '<br /><p>', '</p>'); ?>
    		</div>
    		<?php endwhile;?>
    		<?php endif; ?>
    <!--
    	END Page loop
    -->
    	</div>
    
    <?php
    get_footer();
    Thread Starter sebashton

    (@sebashton)

    excellent works well now, thank you

    Forum: Plugins
    In reply to: Gravatar

    if you are wanting to use this widget inside the comment loop have you thought about using the get_avatar() function instead?

    or if it is to actually sign up to gravatar itself have you had a look at the installation docs here

    NB: Users don’t ‘sign in’ to gravatar on your site – your site will reference gravatar to get a users avatar using their email if they have one.

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