Tony

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Category Conditional Stament #1392764
    Tony
    Participant

    This does not work. I get this error –

    in reply to: Category Conditional Stament #1385715
    Tony
    Participant

    True this is NOT a template override file. This is a custom template that I have made based of my page.php.
    True this file only loads for pages using this as its template.
    False, there is no sidebar, it just comes through as part of the content.
    I have tried has_term(); and it still does not work.

    I simply started an events loop like this –

    
    <?php
    $events = tribe_get_events( array(
    	'posts_per_page' => 6,
    	'start_date' => date( 'F j, Y' ),
    ));
    
    if ( empty( $events ) ) {
    echo 'Sorry, there are no upcoming events at this time.';
    }
    
    else foreach( $events as $event ) { ?>
    

    And then I threw in a simple conditional using your recommendation like this.

    
    <?php $tecmain = Tribe__Events__Main::instance(); ?>
    
    <?php if(is_tax($tecmain::TAXONOMY, 22)) { ?>
    <p>C&P</p>
    <?php } elseif(is_tax($tecmain::TAXONOMY, 23)) { ?>
    <p>Fundraising</p>
    <?php } elseif(is_tax($tecmain::TAXONOMY, 24)) { ?>
    <p>Educational</p>										
    <?php } else { ?>
    <img class="cat-icon" src="/wp-content/uploads/2017/11/Heart.png" />
    <?php } ?>
    

    This loop clearly works on my end because directly below this I display the title and event start time like this which comes through just fine –

    
    <?php $title = get_the_title($event); ?>
    <?php if (strlen($title) > 30) { ?>
    <?php echo mb_strimwidth($title, 0, 30, '...'); ?>
    <?php } else { ?>
    <?php echo $title ?>
    <?php }?>
    

    Any ideas as to why this isn’t working?

    in reply to: Category Conditional Stament #1384763
    Tony
    Participant

    Could it not be coming through because these events have two categories associated with them?

    in reply to: Category Conditional Stament #1383711
    Tony
    Participant

    This reply is private.

    in reply to: Category Conditional Stament #1382935
    Tony
    Participant

    This reply is private.

    • This reply was modified 8 years, 5 months ago by Tony.
    in reply to: Category Conditional Stament #1382552
    Tony
    Participant

    And just to be clear I tried the slug and nicename as well.

    in reply to: Category Conditional Stament #1382548
    Tony
    Participant

    This still does not work for me. Is this the implementation you would use here?

    <?php $tecmain = Tribe__Events__Main::instance(); ?>
    
    											<?php if(is_tax($tecmain::TAXONOMY, 22)) { ?>
    											<p>C&P</p>
    											<?php } elseif(is_tax($tecmain::TAXONOMY, 23)) { ?>
    											<p>Fundraising</p>
    											<?php } elseif(is_tax($tecmain::TAXONOMY, 24)) { ?>
    											<p>Educational</p>										
    											<?php } else { ?>
    											<img class="cat-icon" src="/wp-content/uploads/2017/11/Heart.png" />
    											<?php } ?>
    in reply to: Category Conditional Stament #1380020
    Tony
    Participant

    Anyone there? Trying to push this site live ASAP. Thanks.

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