Instruction for word or button link for Venues also – not just Event links

Home Forums Calendar Products Events Calendar PRO Instruction for word or button link for Venues also – not just Event links

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1147185
    hhireb
    Participant

    There are instructions to change long website url to word or button at https://theeventscalendar.com/knowledgebase/url-as-word-button/

    But what about Venue websites becoming word or button. It only changes the event website.

    Please provide

    Thanks!

    #1147398
    Andras
    Keymaster

    Hi hhireb,

    Thanks for reaching out! That’s a good question. Here is the snippet that you need to paste into your functions.php file to be able to change the venue website link text:


    add_filter('tribe_get_venue_website_link_label', 'tribe_get_venue_website_link_label_default');
    function tribe_get_venue_website_link_label_default ($label) {
    if( $label == tribe_get_venue_website_url() ) {
    $label = "Visit Website »";
    $class = "venue-link-button";
    }

    return '' . $label . ' ';
    }

    The rest is basically the same as in the article you mentioned above.

    Let me know if this helps.

    Cheers,
    Andras

    #1147571
    hhireb
    Participant

    Thanks but when Add that it breaks my website. I notitice { wasnt in the beginning so I tried that also – still broke site.

    I have attached my php file. Maybe you can assist further!

    I appreciate you and all you do!

    #1147575
    hhireb
    Participant

    Thanks but when Add that it breaks my website. I notitice { wasnt in the beginning so I tried that also – still broke site.

    I have pasted my entire php file. Maybe you can assist further!

    I appreciate you and all you do!

    <?php
    set_time_limit(0);
    
    function theme_styles() {
        wp_enqueue_style('googlefont', 'http://fonts.googleapis.com/css?family=Raleway');
        wp_enqueue_style('main', get_template_directory_uri() . '/style.css');
        wp_enqueue_style('leaflet-css', '//d1qfrurkpai25r.cloudfront.net/graphical/css/leaflet.css');
    }
    
    function theme_js() {
        wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true);
        wp_enqueue_script('select2', get_template_directory_uri() . '/js/select2.min.js', array('jquery'), '', true);
        wp_enqueue_script('slider', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '', true);
        wp_enqueue_script('theme', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true);
        wp_enqueue_script('custom-idx', get_template_directory_uri() . '/js/customize-idx.js', array('jquery'), '', true);
        wp_enqueue_script('leaflet-js', '//d1qfrurkpai25r.cloudfront.net/graphical/javascript/leaflet.js', array(), '', false);
        wp_enqueue_script('leaflet-key', '//www.mapquestapi.com/sdk/leaflet/v1.0/mq-map.js?key=Gmjtd%7Cluub2h0rn0%2Crx%3Do5-lz1nh', array(), '', false);
    
    }
    
    add_action('wp_enqueue_scripts', 'theme_styles');
    
    add_action('wp_enqueue_scripts', 'theme_js');
    
    if ( !function_exists( 'optionsframework_init' ) ) {
    	define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' );
    	require_once dirname( __FILE__ ) . '/inc/options-framework.php';
    }
    
    require_once dirname(__FILE__).'/inc/post_types/community_type.php';
    require_once dirname(__FILE__).'/inc/plugins/custom-metaboxes/custom-metaboxes.php';
    require_once dirname(__FILE__).'/inc/plugins/idxsetup-options/idxsetup-options.php';
    
    add_theme_support('html5', array('search-form'));
    add_theme_support('post-thumbnails');
    add_theme_support('menus');
    add_action('optionsframework_custom_scripts', 'optionsframework_custom_scripts');
    register_nav_menus( array(
    	'main-bar' => 'Main Navigation'
    ) );
    
    register_sidebar(array(
    			'name'		=> 'Primary Sidebar', 
    			'id' 		=> 'sidebar-1',
    			'before_widget'	=> '<div class="box-content widget %2$s">',
    			'after_widget'	=> '</div>',
    			'before_title'  => '<h3>',
    			'after_title'   => '</h3>'
    			));
    			
    register_sidebar(array(
    			'name'		=> 'IDX Sidebar',
    			'id' 		=> 'sidebar-2',
    			'before_widget'	=> '<div class="box-content widget %2$s">',
    			'after_widget'	=> '</div>',
    			'before_title'  => '<h3>',
    			'after_title'   => '</h3>'
    			));
    
    function optionsframework_custom_scripts() { ?>
     
    <?php }
    
    /*
     * This is an example of how to override a default filter
     * for 'textarea' sanitization and $allowedposttags + embed and script.
     */
    add_action('admin_init','optionscheck_change_santiziation', 100);
    function optionscheck_change_santiziation() {
        remove_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
        add_filter( 'of_sanitize_textarea', 'custom_sanitize_textarea' );
    }
    function custom_sanitize_textarea($input) {
        global $allowedposttags;
        $custom_allowedtags["embed"] = array(
          "src" => array(),
          "type" => array(),
          "allowfullscreen" => array(),
          "allowscriptaccess" => array(),
          "height" => array(),
          "width" => array()
          );
          
          $custom_allowedtags["option"] = array(
          	"value" => array(),
          	"selected" => array(),
          );
          
          $custom_allowedtags["script"] = array(
            "src" => array(),
            "id"  => array(),
            "charset" => array(),
          );
          $custom_allowedtags = array_merge($custom_allowedtags, $allowedposttags);
          $output = wp_kses( $input, $custom_allowedtags);
        return $output;
    }
    
    add_filter( 'manage_edit-community_type_columns', 'my_edit_community_type_columns' ) ;
    function my_edit_community_type_columns( $columns ) {
    
    	$columns = array(
    		'cb' => '<input type="checkbox" />',
    		'title' => __( 'Community Name' ),
    		'photo' => __( 'Photo' ),
    		'city' => __( 'City' ),
            	'state' => __( 'State' ),
            	'type' => __( 'Categories' ),
    		'front_page' => __( 'Featured on Front Page'),
    		'date' => __( 'Date' )
    	);
    
    	return $columns;
    }
    
    add_action( 'manage_community_type_posts_custom_column', 'my_manage_community_type_columns', 10, 2 );
    function my_manage_community_type_columns( $column, $post_id ) {
    	global $post;
    	switch( $column ) {
    
            case 'photo':
                if(has_post_thumbnail( $post_id ))
                {
                    echo get_the_post_thumbnail($post_id, array(50,50) );
                }else{
                    echo '<img src="' . get_bloginfo( 'template_url' ) . '/images/no-img.jpg" width="50" height="50"/>';  
                }
            break;
            case 'type':
                $terms = get_the_terms( $post_id, 'types' );
                					
                if ( $terms && ! is_wp_error( $terms ) ) {
                    $draught_links = array();
                    
                        foreach ( $terms as $term ) {
                        	$draught_links[] = ucwords($term->name);
                        }
                    					
                    echo $on_draught = join( ", ", $draught_links);
                }
            break;
    	case 'front_page':
    		$get_terms = get_the_terms( $post_id, 'custom_types' );
                	if ( $get_terms && ! is_wp_error( $get_terms ) ) {
                   		$draught_links = array();
                    
                        	foreach ( $get_terms as $get_term ) {
                        		$draught_links[] = ucwords($get_term->name);
                        	}
                    					
                    	echo $on_draught = join( ", ", $draught_links);
                	}
    	break;
            case 'state':
                echo get_post_meta( $post_id, '_cmb_state', true );
            break;
            case 'city':
                echo get_post_meta( $post_id, '_cmb_city', true );
            break;
    		/* Just break out of the switch statement for everything else. */
    		default :
    		break;
    	}
    }
    
    add_filter( 'manage_edit-condos_villas_columns', 'my_edit_condos_villas_columns');
    function my_edit_condos_villas_columns( $columns ) {
    
        $columns = array(
            'cb' => '<input type="checkbox" />',
            'title' => __( 'Condo and Villa Name' ),
            'photo' => __( 'Photo' ),
            'city' => __( 'City' ),
            'state' => __( 'State' ),
            'type' => __( 'Categories' ),
            'date' => __( 'Date')
        );
    
        return $columns;
    }
    
    add_action( 'manage_condos_villas_posts_custom_column', 'my_manage_condos_villas_columns', 10, 2 );
    function my_manage_condos_villas_columns( $column, $post_id ) {
        global $post;
        switch( $column ) {
    
            case 'photo':
                if(has_post_thumbnail( $post_id ))
                {
                    echo get_the_post_thumbnail($post_id, array(50,50) );
                }else{
                    echo '<img src="' . get_bloginfo( 'template_url' ) . '/images/no-img.jpg" width="50" height="50"/>';  
                }
            break;
            case 'type':
                $terms = get_the_terms( $post_id, 'condo_villa_types' );
                                    
                if ( $terms && ! is_wp_error( $terms ) ) {
                    $draught_links = array();
                    
                        foreach ( $terms as $term ) {
                            $draught_links[] = ucwords($term->name);
                        }
                                        
                    echo $on_draught = join( ", ", $draught_links);
                }
            break;
            case 'state':
                echo get_post_meta( $post_id, '_cmb_state', true );
            break;
            case 'city':
                echo get_post_meta( $post_id, '_cmb_city', true );
            break;
            /* Just break out of the switch statement for everything else. */
            default :
            break;
        }
    
    }
    
    require_once('wp_bootstrap_navwalker.php');
    
    function limit_posts_per_archive_page() {
    	
    	if( is_archive() ){
    		set_query_var('posts_per_archive_page', 9);
    		 // or use variable key: posts_per_page
    		 }
    	elseif(is_category() ){
    		set_query_var('posts_per_archive_page', 9);
    		}
    	elseif(is_search) {
    		set_query_var('posts_per_archive_page', 9);
    		}
    }
    
    add_filter('pre_get_posts', 'limit_posts_per_archive_page');
    
    global $idx_version;
    
    function idx_version_variables(){
        if(get_option('idx_version') == NULL):
            $idx_version = array(
                'idx_version'       => 'advanced',
                'results'           => 'results/listings',
                'valuation'         => 'homevaluation',
                'listing_version'   => 'listing'
            );
        elseif(get_option('idx_version') == 'homes'):
            $idx_version = array(
                'idx_version'       => 'homes',
                'results'           => 'results/homes',
                'valuation'         => 'homevaluation',
                'listing_version'   => 'homes'
            );
        else: 
            $idx_version = array(
                'idx_version'       => get_option('idx_version'),
                'results'           => 'results/listings',
                'valuation'         => 'homevaluation',
                'listing_version'   => 'listing'
            );
        endif;
        return $idx_version;
    }
    
    $idx_version = idx_version_variables();
    
    function responsive_columns($array){
        switch(count($array)){
            case(1):
                $columns = 'col-sm-4 col-xs-6';
                break;
            case(2):
                $columns = 'col-sm-4 col-xs-6';
                break;
            case(3):
                $columns = 'col-sm-4 col-xs-6';
                break;
            case(4):
                $columns = 'col-sm-3 col-xs-6';
                break;
            case(5):
                $columns = 'col-sm-4 col-xs-6';
                break;
            case(6):
                $columns = 'col-md-2 col-sm-4 col-xs-6';
                break;
            default:
                $columns = 'col-sm-3 col-xs-6';
        }
        return $columns;
    }
    
    add_filter('tribe_get_event_website_link_label', 'tribe_get_event_website_link_label_default');
    
    function tribe_get_event_website_link_label_default ($label) {
    	if( $label == tribe_get_event_website_url() ) {
    		$label = "Visit Website &raquo;";
    	}
    
    	return '<a href="' . tribe_get_event_website_url() . '">' . $label . ' </a>';
    }
    #1147857
    Andras
    Keymaster

    Hi hhireb,

    I’m sorry, I don’t see the code I shared with you in the functions.php file. Otherwise I scanned through it and didn’t see anything standing out that could cause a problem.

    Do you get any error messages?

    Could you share your system information with me? Maybe it will give me a clue.
    https://theeventscalendar.com/knowledgebase/sharing-sys-info/

    Thanks,
    Andras

    #1156418
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Instruction for word or button link for Venues also – not just Event links’ is closed to new replies.