Changing the Single Event Page Layout

Home Forums Calendar Products Events Calendar PRO Changing the Single Event Page Layout

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1117259
    Joelle
    Participant

    Hello, my client chose to go with your calendar over the All-in-One Events calendar from Time.ly she’s been using for years. However, we’re struggling with the layout of the events page.

    Is there any way to rearrange the page without dismantling the original plugin’s templates?

    One of the key reasons for purchase was the “custom field” option, but now that content is buried way at hte bottom of the page with a big long ugly link instead of a nice tidy button or similar (she’d like it at the top)

    And it would be great to otherwise hide/rearrange some of the data.

    Is there information on doing this somewhere? 🙂 Thank you!

    #1117270
    Joelle
    Participant

    Derp, I found this, naturally. The obvious source of information. 🙂 I’m hoping this is what I need.

    #1117278
    Joelle
    Participant

    Hello again. 🙂

    I’m hoping someone can assist me in pulling out individual additional fields. I have two separate ones and I’d like to display them in separate places on the page. I know which files to edit, with the Themers Guide, but I’m unclear how to determine the extra fields I need based on this from the /srcs/views/pro/modules/meta/additional-fields.php file.

    `<div class=”tribe-events-meta-group tribe-events-meta-group-other”>

    <?php esc_html_e( ‘Other’, ‘tribe-events-calendar-pro’ ) ?>

    <dl>
    <?php foreach ( $fields as $name => $value ): ?>
    <dt> <?php echo esc_html( $name ); ?> </dt>
    <dd class=”tribe-meta-value”>
    <?php
    // This can hold HTML. The values are cleansed upstream
    echo $value;
    ?>
    </dd>
    <?php endforeach ?>
    </dl>
    </div>

    I really appreciate your assistance here. Thank you!

    #1117300
    Joelle
    Participant

    Well, I guess a “nevermind” is in order because it looks like you don’t offer assistance with this per this thread. 🙁

    I don’t understand why it tribe_get_custom_field was deprecated, it does *exactly* what I need it to do, but with your other method, it seems a lot more complicated to pull out one simple field.

    So there’s no straightforward tip for how to get it to display just ONE field instead of the whole array despite it being available before?

    Thanks. 🙂

    #1117302
    Cliff
    Member

    Hi Joelle. Thanks for your thoroughness. We hope you’ll get comfy with our calendar suite. 🙂

    Yes, our Themer’s Guide (that you linked to) is our main help for these customizations.

    Although I’m not exactly clear what you’re wanting, I can point you to the tribe_get_custom_fields() method (the deprecated method ends in ‘field’, not ‘fields’)

    I also found get_custom_field_by_label() in /wp-content/plugins/events-calendar-pro/src/Tribe/Custom_Meta.php, which is actually the method used by the deprecated tribe_get_custom_field()

    Please let me know if any of that helped and if I can be of further assistance.

    #1117327
    Joelle
    Participant

    Hi Cliff!

    I want to show just one of my additional fields, not the full array, which is what happens with tribe_get_custom_fields.

    The deprecated snippet actually does what I want. I’m not understood on why they deprecated it without offering a comparable solution to displaying a single custom field.

    I hope that makes it clearer. 🙂 thank you for responding!

    #1117487
    Cliff
    Member

    Joelle,

    I believe get_custom_field_by_label(), mentioned previously, is exactly what you want.

    Did you try using it yet?

    #1117489
    Joelle
    Participant

    I did, it gives me a fatal error:

    Fatal error: Call to undefined function get_custom_field_by_label() in /home/knitagog/public_html/stage/wp-content/themes/fibrespacesixteen/tribe-events/single-event.php on line 51

    #1117492
    Cliff
    Member

    Please share your full code snippet for review.

    #1117493
    Joelle
    Participant

    Sure thing. I’m not a php wizard, I’m really just doing my best. 🙂

    <?php if ( custom_field_by_label('Instructor') ) : ?>
    		<div class="tribe-events-instructor"><strong>Instructor:</strong> <?php echo custom_field_by_label('Instructor'); ?></div>
    		<?php endif; ?>
    #1117512
    Cliff
    Member

    Thanks for that. There were several issues, most importantly: custom_field_by_label isn’t the name of the function (it was missing starting with get_) and it’s technically a method because it’s a function in a PHP class.

    Long story short, try this out 😉

    https://gist.github.com/cliffordp/4912b6e0e5ffc67e312264336f1218b8

    Let me know if it works for you.

    #1117564
    Joelle
    Participant

    Thanks, Cliff. We’ll give that a try. It seems kind of silly to have so many lines of code to do one simple thing that was working and still works. I’m not a super programmer or anything, so Im assuming there was a good reason for it, but it seems like less is more.

    Anyway, I’ll give it ago. Thank you! I appreciate your help. 🙂

    • This reply was modified 9 years, 11 months ago by Joelle.
    #1117599
    Joelle
    Participant

    The solution, which was sussed out with a friend of mine, is this:

    At the top, this:

    $events_label_singular = tribe_get_event_label_singular();
    $events_label_plural = tribe_get_event_label_plural();
    
    $event_id = get_the_ID();
    $eventFields = tribe_get_custom_fields();

    Then, where I require the instance of a singular custom field:

    <a href="<?php echo $eventFields['Register Now']; ?>" class="register_now">Register Now</a>

    This works just great.

    • This reply was modified 9 years, 11 months ago by Joelle.
    #1117727
    Cliff
    Member

    I’m glad you got a solution you’re happy with.

    $eventFields = tribe_get_custom_fields();
    echo $eventFields['Register Now'];

    is the same as

    echo Tribe__Events__Pro__Custom_Meta::get_custom_field_by_label( 'Register Now', $event_id );

    If you’re going to be pulling more than one Additional Field in your implementation, the way your friend did it is more performant because of not having to run  Tribe__Events__Pro__Custom_Meta::get_custom_field_by_label() multiple times.

    However, the additional code I included is probably desirable and should be considered in your final implementation. For example, you probably don’t want to output a blank value or get a PHP error because the value is an array and not a string.

    Anyway, I’ll close this ticket. Feel free to open a new one if you have another situation come up.

    Have a great day!

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Changing the Single Event Page Layout’ is closed to new replies.