• Resolved ldalgo

    (@ldalgo)


    Hi, thank you for your plugin. The best design as compared to competitors.
    Is it possible to automatically display event (post) author as WP user in the event details instead of or in addition to organizers?
    Thanks!

    • This topic was modified 5 years, 2 months ago by ldalgo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ldalgo

    (@ldalgo)

    I’ve already found a solution. If someone else needs it, you can do it as follows:

    Add this to modern-events-calendar/app/skins/single/default.php AFTER line 76 (for instance)

    
    <?php
    // Get Author Data
    $author             = get_the_author();
    $author_description = get_the_author_meta( 'description' );
    $author_url         = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
    $author_avatar      = get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'wpex_author_bio_avatar_size', 75 ) );
    
    ?>
    
        <div class="author-info clr">
            <h4 class="heading"><span><?php printf( esc_html__( 'Added by %s', 'text_domain' ), esc_html( $author ) ); ?></span></h4>
            <div class="author-info-inner clr">
                <?php if ( $author_avatar ) { ?>
                    <div class="author-avatar clr">
                        <a>" rel="author">
                            <?php echo $author_avatar; ?>
                        </a>
                    </div><!-- .author-avatar -->
                <?php } ?>
                <div class="author-description">
                    <p><?php echo wp_kses_post( $author_description ); ?></p>
                    <p><?php echo do_shortcode('[ksam]');?> →</a><p>
                </div><!-- .author-description -->
            </div><!-- .author-info-inner -->
        </div><!-- .author-info -->
    

    Contact author link (if you don’t need it, delete the line with [ksam] shortcode above. Add this to child theme’s functions.php

    	
    	function bpfr_message_shortcode() {	
    $author = get_the_author();
    $message = 'Please sign in to send a message to this author!';
    
    if( is_user_logged_in() ) {
    	return '<a>Contact the author</a>';
     } else {
        return $message;
     }
    } 
    add_shortcode( 'ksam', 'bpfr_message_shortcode' );
    • This reply was modified 5 years, 1 month ago by ldalgo.
    • This reply was modified 5 years, 1 month ago by ldalgo.
    • This reply was modified 5 years, 1 month ago by ldalgo.
    Plugin Contributor webnus

    (@webnus)

    Hello @ldalgo,

    Thank you for sharing.
    We hope others enjoy using it as well.

    Best Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show event author (not organizer)’ is closed to new replies.