Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Evan Herman

    (@eherman24)

    Hello,

    This has been asked a number of times. You need to implement custom HTML excerpts, which requires a custom snippet.

    Most recently:
    https://www.ads-software.com/support/topic/embed-not-working-on-timeline-announcement?replies=2

    https://www.wp-timelineexpress.com/documentation/enable-html-excerpts/

    Thank you,
    Evan

    Thread Starter idet2

    (@idet2)

    Oh!!! I see!

    I ‘ve bumped onto that post but didn’t understand that it was the same issue.

    I ‘ll try the suggested solution.

    Many thanks!

    Plugin Author Evan Herman

    (@eherman24)

    No problem at all. If you run into any issues with the code snippet – feel free to post back here, and I’ll help out best I can.

    Thanks so much!
    Evan

    Thread Starter idet2

    (@idet2)

    Hi Evan!

    Indeed I have problems since I had already enabled the HTML excerpts because I wanted to have the link appearing on the announcement.

    My problem is that if I add an image as media in the new “Custom excerpt” box instead of showing the image itself (as it should according to the post of HTML excerpts that you ‘ve send me) it just shows a clickable link to it.

    Any ideas???

    Many thanks!

    Plugin Author Evan Herman

    (@eherman24)

    If you’ve added an image to the HTML excerpt field, it should then appear as an image. I have tested this a few times, and confirm it does work.

    Please try switching themes and testing again.

    Thread Starter idet2

    (@idet2)

    I see!

    I’ve to find a maintenance window not to have visitors on the site to test it then.

    For reference the theme that I am using is the “Customizr” (https://presscustomizr.com)

    Plugin Author Evan Herman

    (@eherman24)

    Are you using free or pro? I can try testing with the free version – but don’t have access to the pro version.

    Evan

    Thread Starter idet2

    (@idet2)

    Evan,

    I am using the free version on both the theme and the plugin itself (for the moment)

    Plugin Author Evan Herman

    (@eherman24)

    I am currently testing against the free version of the theme – give me a few minutes.

    Plugin Author Evan Herman

    (@eherman24)

    It does appear to be working on my end with the free version of that theme.

    Backend:
    https://www.diigo.com/item/image/4s1ed/vh9c

    Frontend:
    https://www.diigo.com/item/image/4s1ed/yev1

    Are you adding the image to the ‘text’ or to the ‘visual’ tab of the WSYIWYG editor for the custom excerpt?

    Evan

    Thread Starter idet2

    (@idet2)

    I am using the “visual” editor and I am attaching the image using the “add media” option.

    Thread Starter idet2

    (@idet2)

    Do you think that it may conflicts with the addition for the sort of posts using the publication time stamp that we have discussed previously ?

    Plugin Author Evan Herman

    (@eherman24)

    No, that shouldn’t have an effect on it.

    What are the two snippets that you have added to your functions.php file? Please copy and paste them here as they appear in your functions.php file.

    Evan

    Thread Starter idet2

    (@idet2)

    Here you are!

    /**
    * Timeline Express Add Custom Metabox
    * @param array $options Array of options for Timeline Express.
    */
    function define_custom_excerpt_metabox( $options ) {$announcement_custom_metabox = new_cmb2_box( array(
    ‘id’ => ‘custom_meta’,
    ‘title’ => __( ‘Announcement Custom Excerpt’, ‘text-domain’ ),
    ‘object_types’ => array( ‘te_announcements’ ), // Post type
    ‘context’ => ‘advanced’,
    ‘priority’ => ‘high’,
    ‘show_names’ => true, // Show field names on the left
    ) );
    // Container class
    $announcement_custom_metabox->add_field( array(
    ‘name’ => __( ‘Custom Excerpt’, ‘text-domain’ ),
    ‘desc’ => __( ‘Enter the custom excerpt for this announcement in the field above.’, ‘text-domain’ ),
    ‘id’ => ‘announcement_custom_excerpt’,
    ‘type’ => ‘wysiwyg’,
    ) );
    }
    add_action( ‘timeline_express_metaboxes’, ‘define_custom_excerpt_metabox’ );

    /**
    * Replace the default excerpt with our new custom excerpt
    * @param string $excerpt The original announcement excerpt.
    * @param integer $post_id The announcement post ID
    * @return string Return the new excerpt to use.
    */
    function replace_default_timeline_express_excerpt( $excerpt, $post_id ) {
    if ( timeline_express_get_custom_meta( $post_id, ‘announcement_custom_excerpt’, true ) ) {
    return apply_filters( ‘the_content’, get_post_meta( $post_id, ‘announcement_custom_excerpt’, true ) );
    } else {
    return $excerpt;
    }
    }
    add_filter( ‘timeline_express_frontend_excerpt’, ‘replace_default_timeline_express_excerpt’, 10, 2 );

    /**
    * Filter the Timeline Express query ‘orderby’ param & add a date fallback
    *
    * Timeline Express sorts by the announcement date by default.
    * Use this function to fallback to the published date when two
    * or more announcements are using the same announcement date.
    * This allows for manual control over the order of announcements.
    *
    * Reference: https://www.ads-software.com/support/topic/order-same-date-timeline
    * Source Code: https://github.com/EvanHerman/timeline-express/blob/master/lib/classes/class.timeline-express-initialize.php#L86
    */
    function timeline_express_sort_by_published_date_fallback( $args, $post, $atts ) {
    $args[‘orderby’] = $args[‘orderby’] . ‘ date’;
    return $args;
    }
    add_filter( ‘timeline_express_announcement_query_args’, ‘timeline_express_sort_by_published_date_fallback’, 10, 3 );

    Plugin Author Evan Herman

    (@eherman24)

    Even with the code that you just provided me, the images are still showing up properly. I can’t seem to figure out what may be wrong. I’ve copied the entire 3 blocks of code from your previous comment, saved, and refreshed and things appear fine on my end.

    Can you share a URL to your website?

    What other plugins do you have installed?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Embed media into announcement’ is closed to new replies.