flint_and_tinder
Forum Replies Created
-
Solution if anyone ever needs it:
<div id="ca-container" class="ca-container"> <div class="ca-wrapper"> <?php global $post; $current_date = date('j M Y'); /* get upcoming 30 day event, you can edit this to less day */ $end_date = date('j M Y', strtotime('180 days')); $terms = get_terms( 'tribe_events_cat', array( 'exclude' => '3,9,27,31,26,14', 'parent' => '0', 'hide_empty' => 1 )); $i = 1; foreach($terms as $tribe_category) { echo '<div class="ca-item ca-item-'.$i.' '.$tribe_category->slug.'">'; $i++; /* Featured Event */ $all_events_one = tribe_get_events( array( 'post_type' => 'tribe_events', 'start_date' => $current_date, 'end_date' => $end_date, 'eventDisplay' => 'upcoming', 'posts_per_page'=> 1, 'tax_query'=> array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $tribe_category ) ) ) ); /* Sub Event */ $all_events_two = tribe_get_events( array( 'post_type' => 'tribe_events', 'start_date' => $current_date, 'end_date' => $end_date, 'eventDisplay' => 'upcoming', 'posts_per_page'=> 3, 'offset' => 1, 'tax_query'=> array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $tribe_category ) ) ) ); foreach($all_events_one as $post) { setup_postdata($post); ?> <div class="ca-item-main"> <div class="event-thumb"> <?php if(has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium');?></a> <?php } else { ?> <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/the-spring-fallback-medium.gif" alt="The Spring" /></a> <?php } ?> </div> <div class="ca-featured"> <h2><?php echo $tribe_category->name; ?></h2> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <h4 class="event-date"><?php echo tribe_get_start_date( $post->ID, false, 'M j, Y - g:i a'); ?></h4> <div class="event-excerpt"> <?php echo excerpt(40); ?> <a href="<?php the_permalink(); ?>">Read more…</a> </div> </div> <a href="#" class="ca-more button" style="display: block;">more...</a> </div> <?php } //endforeach wp_reset_query(); ?> <!-- start sub-event --> <div class="ca-content-wrapper"> <?php foreach($all_events_two as $post) { setup_postdata($post); ?> <div class="ca-content clearfix"> <div class="left"> <?php if(has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail');?></a> <?php } else { ?> <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/the-spring-fallback-thumb.gif" alt="The Spring" /></a> <?php } ?> </div> <div class="ca-content-text right"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <h5 class="event-date"><?php echo tribe_get_start_date( $post->ID, false, 'M j, Y - g:i a'); ?></h5> <?php echo excerpt(20); ?><br /><a href="<?php the_permalink(); ?>">Read more…</a> </div> </div> <?php } // end foreach wp_reset_query(); ?> <!-- end sub-event --> <a href="#" class="ca-close">close</a> </div> <?php echo '</div>'; // end div.ca-item } // end foreach($terms as $tribe_category) ?> </div> <!-- ca-wrapper --> </div> <!-- ca-container -->
Forum: Fixing WordPress
In reply to: Terms as links with slugs as link classHtml output should have looked like this:
<ul> li class="term1">Term1,</li> <li class="term2">Term2,</li> <li class="term3">Term3</li> </ul>
Forum: Plugins
In reply to: [PHP Code Widget] [Plugin: PHP Code Widget] didnt workMuch better thanks.
I appear to have fixed it by adding a simple
global $post;
at the top of the loop.Forum: Plugins
In reply to: [PHP Code Widget] [Plugin: PHP Code Widget] didnt workWhat a useful reply that is Samuel.
It doesn’t work for me either, I’m trying to use the following code, which works fine in the template, but not when I use it in the widget:
<?php $custom_taxterms = wp_get_object_terms( $post->ID, 'tribe_events_cat', array('fields' => 'ids') ); $args = array( 'post_type' => 'tribe_events', 'post_status' => 'publish', 'posts_per_page' => 3, 'orderby' => 'rand', 'tax_query' => array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'id', 'terms' => $custom_taxterms ) ), 'post__not_in' => array ($post->ID), ); $related_items = new WP_Query( $args ); if ($related_items->have_posts()) : echo '<div>'; while ( $related_items->have_posts() ) : $related_items->the_post(); ?> <div> <h4><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4> <h5><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date(); ?></h5> <p><?php echo excerpt(20); ?></p> </div> <?php endwhile; echo '</div>'; endif; wp_reset_postdata(); ?>
Forum: Plugins
In reply to: [The Events Calendar] [Plugin: The Events Calendar] Echo Category NameOnly thing sent was order receipt containing links to wp-admin, but all ok, I’m in now.
Forum: Plugins
In reply to: [The Events Calendar] [Plugin: The Events Calendar] Echo Category NameQuick unrelated question; what details do I use to login to the PRO forums?
Forum: Plugins
In reply to: [The Events Calendar] [Plugin: The Events Calendar] Echo Category NameThanks but can’t be arsed to re-code. I’ll do without.
Forum: Plugins
In reply to: [The Events Calendar] [Plugin: The Events Calendar] Echo Category NameSorry should have mentioned, I also need to exclude a category used by my homepage slider. So far I have this:
<?php $terms = get_the_terms(get_the_ID(), 'tribe_events_cat'); $count = count($terms); foreach ( $terms as $term ) { if($term->term_id != 3) { // the term ID you want to exclude echo $term->slug; } }?>
Forum: Plugins
In reply to: [The Events Calendar] [Plugin: The Events Calendar] Echo Category NameHow would I add a comma separator to Jonah’s code?
Forum: Plugins
In reply to: [The Events Calendar] plug-in pulling in 2 types of jquery, how to remove?Ignore me, I’ve spotted that the theme was pulling it in in the footer.
It seems to work if you delete the original plugin, then re-install a fresh version with 3.5 in place.
I can confirm that an else statement will work like so:
<?php if (class_exists( 'kdMultipleFeaturedImages') && kd_mfi_get_the_featured_image('logo-featured', 'projects')) { ?> <li> <?php kd_mfi_the_featured_image('logo-featured', 'projects' );?> </li> <?php } else { ?> <img src="<?php bloginfo('template_directory');?>/images/link-plus.gif" width="9" height="9" /> <?php } ?>
a-ha! I have managed to get my code to work like so:
<?php if (class_exists( 'kdMultipleFeaturedImages') && kd_mfi_get_the_featured_image('web-featured', 'projects')) { ?> <li> <?php kd_mfi_the_featured_image('web-featured', 'projects' );?> </li> <?php } ?>
Therefore surely you should be able to add an else statement to that giving you a fallback image. I think.
I also think I should learn php.
Obviously my code doesn’t have a fallback, but surely you should be able to add in an else to my if?
Once my if works… ??
I’m nearly there. I’m playing around with this but it’s not quite right. Perhaps this is a springboard for someone who actually knows php? ??
<?php if(kd_mfi_get_the_featured_image('web-featured', 'projects')) { $slider1 = "kd_mfi_the_featured_image( 'web-featured', 'projects', 'large' );"; echo "<li>$slider1</li>"; } ?>