• Hi,

    I would like to add tags to the VSEL post, because Elementor is adding them to the featured image in posts list block – love it…

    How can I achieve that?

    thank, jo

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

    (@guido07111975)

    Hi Jo,

    This is not possible without making major changes to plugin.
    There’s a reason I did not add this. When clicking a tag-link in the frontend, a default WP page/template is being used to list your events. The events on this page are not ordered by event date. So it’s pretty much useless to add support for tags.
    Same applies to categories, but with categories you can group certain events together and this is being used pretty often (by using the category attribute in the shortcode).

    Guido

    Thread Starter jokr1985

    (@jokr1985)

    Hi Guido,

    thanks for your response.

    I only want to add the Tag to the event and Elementor should display it.

    With the code taken and adapted from here, I’m able to store Tags, but they seemto be CPT-specific. Can I have a solution to add posts (no CPT) Tags?
    https://wordpress.stackexchange.com/questions/62260/how-to-add-tags-to-custom-post-type

    /**
    * Create taxonomies tag for CPT portfolio
    */
    if ( ! function_exists( 'ns_register_vsel_tags' ) ) {
    function ns_register_vsel_tags() {
    
       $labels = array(
        'name' => __( 'Tags', 'ns' ),
        'singular_name' => __( 'Tag', 'ns' ),
        'search_items' =>  __( 'Search Tags' ),
        'popular_items' => __( 'Popular Tags' ),
        'all_items' => __( 'All Tags' ),
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __( 'Edit Tag' ),
        'update_item' => __( 'Update Tag' ),
        'add_new_item' => __( 'Add New Tag' ),
        'new_item_name' => __( 'New Tag Name' ),
        'separate_items_with_commas' => __( 'Separate tags with commas' ),
        'add_or_remove_items' => __( 'Add or remove tags' ),
        'choose_from_most_used' => __( 'Choose from the most used tags' ),
        'menu_name' => __( 'Tags' ),
       );
    
       $args = array(
        'label' => __( 'Tag', 'ns' ),
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'hierarchical' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'show_in_nav_menus' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'tag', 'with_front' => false, ),
        'show_admin_column' => false,
        'show_in_rest' => true,
        'rest_base' => 'tag',
        'rest_controller_class' => 'WP_REST_Terms_Controller',
        'show_in_quick_edit' => true,
        'update_count_callback' => '_update_post_term_count',
    );
    register_taxonomy( 'tag', array( 'event' ), $args );
    }
    add_action( 'init', 'ns_register_vsel_tags', 0 );
    }

    Thanks and kr,
    Jo

    Plugin Author Guido

    (@guido07111975)

    Hi,

    Try adding this to the args to use default post tags:

    'taxonomies' => array('post_tag')

    Will try your tags code later, guess not all args are required.

    My knowledge about Elementor is limited (don’t want to use it) and I think the posts block is part of Pro version, so cannot see the result for myself.

    Guido

    Plugin Author Guido

    (@guido07111975)

    Hi,

    Update: with this tiny tweak you can add tags to events.
    You must change main plugin file “vsel”. Look for:

    'taxonomies' => array( 'event_cat' ),

    Change into:

    'taxonomies' => array( 'event_cat', 'post_tag' ),

    Now the default (post) tags are being added to events. Source here.

    Guido

    Plugin Author Guido

    (@guido07111975)

    Update 2: it’s also possible to do this without changing plugin file.

    Add this in your (child) theme or via the Code Snippets plugin:

    function vsel_tags() {
    	$args = array(
    	'taxonomies' => array( 'post_tag' )
    	);
    	register_post_type( 'event', $args );
    }
    add_action( 'init', 'vsel_tags', 9 );
    

    This will create the event post type with tag support BEFORE my plugin does it. So plugin runs later and adds all other featues.

    Guido

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add Tags’ is closed to new replies.