• Resolved feisar

    (@feisar)


    Is there a way of adding a Read More link/button to the end of the Event Info, when it is set to show a Summary, that links to the relevant Single event page?

    I couldn’t find an option, and the Link to more info option only links to a specific defined URL.

    I added the following code after line 221 of the vsel-page-tenmplate.php file to do it myself, but obviously this gets overwritten when the plugin is updated.

    if (!empty(apply_filters( 'the_content', get_the_content() ))) {
        $output .=  '<a class="button alignright" href="'.get_permalink().'" rel="bookmark">Read more</a>';
    }

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Guido

    (@guido07111975)

    Hi,

    I may add this in a future version.
    For now you can use the Code Snippets plugin and add this snippet. Or add this in file functions of your (child) theme.

    function event_excerpt_more($more) {
    	global $post;
    	if( is_page('534') ) {
    		return ' <a class="button" href="'.get_permalink($post->ID).'">Read more</a>';
    	}
    }
    add_filter('excerpt_more', 'event_excerpt_more');

    Change page ID into your page ID.

    Guido

    Thread Starter feisar

    (@feisar)

    Thank you. Although the snippet above didn’t work for me for some reason, it got me on the right track and the following modified code did work:

    function excerpt_read_more_link($output) {
        global $post;
        if (!empty(apply_filters( 'the_content', get_the_content() ))) {
            return $output . '<a class="button" href="'. get_permalink($post->ID) . '">Read more</a>';
        }
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');
    Plugin Author Guido

    (@guido07111975)

    Hi @feisar

    I may add the read more link in next version.

    Guido

    Thread Starter feisar

    (@feisar)

    Thank you. That would be great.

    I’ve since modified my own custom snippet for my purposes, to only show the Read More link if the Custom Summary is not empty:

    function excerpt_read_more_link($output) {
        global $post;
        if (!empty(get_post_meta($post->ID, 'event-summary', true))) {
            return $output . '<a class="button" href="'. get_permalink($post->ID) . '">Read more</a>';
        } else {
            return $output;
        }
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');

    Plugin Author Guido

    (@guido07111975)

    Hi,

    I will not add extra conditional logic. You can simply activate a more info link underneath the event content. With a (shortcode) attribute to disable it per event list.

    Guido

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add ‘Read more’ link/button after Event Info’ is closed to new replies.