Openstreetmap
-
Good morning,
since I’m developing a site for a soccer team I installed the sportspress plugin everything works correctly except for one thing; premise: I don’t have the paid version of the plugin (so if I’m not mistaken I should see the stadium maps with openstreetmap and not with google maps correct ?) I created a stadium, putting the latitude and longitude only that when I click on the map from the site it takes me to google maps and not to openstreemaps, how can I do to solve this problem ? I hope I explained myself well otherwise I remain available for any clarification. Thank you very much. Attached are some printables. I am waiting for a reply as soon as possible
-
Hi @mattiadelucchi21 ,
SportsPress uses Openstreetmaps as an “engine” for geolocation and to show the map image to the user. On the frontend, while the map image is taken from Openstreetmaps, the link takes you to the same coordinates on Google Maps. This is how SportsPress works by default. On the PRO version, both geolocation engine and map images are based on Google Maps and not Openstreetmaps.
Now, if you want ot change the link also to Openstreetmaps you will need to use some custom code.
First you will need to copy the “venue-map.php” template file of SportsPress to
your-child-theme/sportspress/
folder. Then change the following line from:do_action( 'sp_venue_show_map', $latitude, $longitude, $address, $zoom, $maptype );
To:
do_action( 'custom_sp_venue_show_map', $latitude, $longitude, $address, $zoom, $maptype );
Then add the new output function that will return the appropriate map-image and link at your functions.php file. You can take as reference the following code:
https://github.com/ThemeBoy/SportsPress/blob/eb444db5b88ef343c72856fd3157a24cd25184fc/modules/sportspress-openstreetmap.php#L116-L158Thanks,
SavvasCodice non modificato file venue-map.php:
<?php
/**if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly
}if ( ! isset( $meta ) ) {
return;
}if ( is_tax( ‘sp_venue’ ) ) {
do_action( ‘sportspress_before_venue_map’ );
}$address = sp_array_value( $meta, ‘sp_address’, null );
$address = urlencode( $address );
$latitude = sp_array_value( $meta, ‘sp_latitude’, null );
$longitude = sp_array_value( $meta, ‘sp_longitude’, null );
$zoom = get_option( ‘sportspress_map_zoom’, 15 );
$maptype = get_option( ‘sportspress_map_type’, ‘roadmap’ );
$maptype = strtolower( $maptype );if ( ” === $address ) {
$address = ‘+’;
}
if ( ‘satellite’ !== $maptype ) {
$maptype = ‘roadmap’;
}if ( $latitude != null && $longitude != null ) {
do_action( ‘sp_venue_show_map’, $latitude, $longitude, $address, $zoom, $maptype );
}
if ( is_tax( ‘sp_venue’ ) ) {
do_action( ‘sportspress_after_venue_map’ );
}Codice modificato venue-map.php:
<?php
/**if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly
}if ( ! isset( $meta ) ) {
return;
}if ( is_tax( ‘sp_venue’ ) ) {
do_action( ‘sportspress_before_venue_map’ );
}$address = sp_array_value( $meta, ‘sp_address’, null );
$address = urlencode( $address );
$latitude = sp_array_value( $meta, ‘sp_latitude’, null );
$longitude = sp_array_value( $meta, ‘sp_longitude’, null );
$zoom = get_option( ‘sportspress_map_zoom’, 15 );
$maptype = get_option( ‘sportspress_map_type’, ‘roadmap’ );
$maptype = strtolower( $maptype );if ( ” === $address ) {
$address = ‘+’;
}
if ( ‘satellite’ !== $maptype ) {
$maptype = ‘roadmap’;
}if ( $latitude != null && $longitude != null ) {
do_action( ‘custom_sp_venue_show_map’, $latitude, $longitude, $address, $zoom, $maptype );
}
if ( is_tax( ‘sp_venue’ ) ) {
do_action( ‘sportspress_after_venue_map’ );
}Codice modificato function.php
<?php // THEME FUNCTIONS // Enqueue Styles and Scripts function topclub_enqueue() { // Enqueue Styles wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css' ); wp_enqueue_style( 'line-awesome', get_template_directory_uri() . '/assets/css/line-awesome.css' ); wp_enqueue_style( 'sportspress-custom', get_template_directory_uri() . '/assets/css/sportspress-custom.css' ); wp_enqueue_style( 'woocommerce-custom', get_template_directory_uri() . '/assets/css/woocommerce-custom.css' ); wp_enqueue_style( 'slick', get_template_directory_uri() . '/slick/slick.css' ); wp_enqueue_style( 'lightcase', get_template_directory_uri() . '/assets/css/lightcase.css' ); wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'responsive', get_template_directory_uri() . '/assets/css/responsive.css' ); // Enqueue Fonts wp_enqueue_style( 'montserrat', get_template_directory_uri() . '/assets/css/montserrat.css' ); wp_enqueue_style( 'inter', get_template_directory_uri() . '/assets/css/inter.css' ); // Enqueue Scripts wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.js' ); wp_enqueue_script( 'superfish', get_template_directory_uri() . '/assets/js/superfish.js', array( 'jquery' ) ); wp_enqueue_script( 'supersubs', get_template_directory_uri() . '/assets/js/supersubs.js', array( 'jquery' ) ); wp_enqueue_script( 'slick', get_template_directory_uri() . '/slick/slick.js', array( 'jquery' ) ); wp_enqueue_script( 'lightcase', get_template_directory_uri() . '/assets/js/lightcase.js', array( 'jquery' ) ); wp_enqueue_script( 'colcade', get_template_directory_uri() . '/assets/js/colcade.js', array( 'jquery' ) ); wp_enqueue_script( 'theme-scripts', get_template_directory_uri() . '/assets/js/theme-scripts.js' , array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'topclub_enqueue' ); // Add Text Domain function topclub_textdomain() { load_theme_textdomain( 'topclub', get_template_directory() . '/languages' ); } add_action( 'after_setup_theme', 'topclub_textdomain'); // Register Menus function topclub_register_menus() { register_nav_menus( array( 'main-menu' => __( 'Main Menu', 'topclub' ), ) ); } add_action( 'after_setup_theme', 'topclub_register_menus' ); // Add Theme Support function topclub_add_theme_support() { add_theme_support( 'title-tag' ); add_theme_support( 'post-thumbnails' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-formats', array( 'gallery', 'audio', 'quote', 'video', 'aside', 'image', 'link', 'status', 'chat' ) ); add_theme_support( 'editor-styles' ); add_theme_support( 'sportspress' ); add_theme_support( 'custom-logo', array( 'height' => 150, 'width' => 150, 'flex-height' => true, 'flex-width' => true ) ); add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'script', 'style', ) ); add_editor_style( 'css/editor-styles.css' ); } add_action( 'after_setup_theme', 'topclub_add_theme_support' ); // Add Comments Reply function topclub_comments_reply() { if ( is_singular() && comments_open() && get_option('thread_comments') == 1 ) { wp_enqueue_script('comment-reply'); } } add_action( 'comment_form_before', 'topclub_comments_reply' ); // Register Sidebars function topclub_register_sidebars() { $main_sidebar_args = array( 'id' => 'main-sidebar', 'name' => esc_html__( 'Main Sidebar', 'topclub' ), 'description' => esc_html__( 'Main Sidebar Widgets Area', 'topclub' ), 'class' => 'sidebar-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $main_sidebar_args ); $widget_section_args = array( 'id' => 'widgets-section-area-col1', 'name' => esc_html__( 'Frontpage Widgets Section - Column 1', 'topclub' ), 'description' => esc_html__( 'Widgets Area in Widgets Section ', 'topclub' ), 'class' => 'section-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $widget_section_args ); $widget_section_args = array( 'id' => 'widgets-section-area-col2', 'name' => esc_html__( 'Frontpage Widgets Section - Column 2', 'topclub' ), 'description' => esc_html__( 'Widgets Area in Widgets Section ', 'topclub' ), 'class' => 'section-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $widget_section_args ); $footer_widgets_area_1_args = array( 'id' => 'footer-widgets-area-1', 'name' => esc_html__( 'Footer Widgets Area 1', 'topclub' ), 'description' => esc_html__( 'Column 1', 'topclub' ), 'class' => 'footer-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $footer_widgets_area_1_args ); $footer_widgets_area_2_args = array( 'id' => 'footer-widgets-area-2', 'name' => esc_html__( 'Footer Widgets Area 2', 'topclub' ), 'description' => esc_html__( 'Column 2', 'topclub' ), 'class' => 'footer-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $footer_widgets_area_2_args ); $footer_widgets_area_3_args = array( 'id' => 'footer-widgets-area-3', 'name' => esc_html__( 'Footer Widgets Area 3', 'topclub' ), 'description' => esc_html__( 'Column 3', 'topclub' ), 'class' => 'footer-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $footer_widgets_area_3_args ); $footer_widgets_area_4_args = array( 'id' => 'footer-widgets-area-4', 'name' => esc_html__( 'Footer Widgets Area 4', 'topclub' ), 'description' => esc_html__( 'Column 4', 'topclub' ), 'class' => 'footer-widget', 'before_title' => '<div class="widget-title-wrap"><h3 class="widget-title">', 'after_title' => '</h3></div>', 'before_widget' => '<div class="widget-container"><div id="%1$s" class="widget-inner-container %2$s">', 'after_widget' => '</div></div>', ); register_sidebar( $footer_widgets_area_4_args ); } add_action( 'widgets_init', 'topclub_register_sidebars' ); // Add Thumbnails Sizes function topclub_thumbnails_setup() { if ( function_exists( 'add_image_size' ) ) { add_image_size( 'topclub-archive-post-thumb', 360, 230, true ); add_image_size( 'topclub-single-post-thumb', 1110, 600, false ); add_image_size( 'topclub-media-thumb', 1140, 1140, false ); add_image_size( 'topclub-sp-team-logo-thumb', 200, 200, false ); add_image_size( 'topclub-media-section-thumb', 450, 220, true ); add_image_size( 'topclub-shop-section-thumb', 450, 450, false ); } } add_action( 'after_setup_theme', 'topclub_thumbnails_setup' ); // Set Content Width if ( !isset( $content_width ) ) { $content_width = 1920; } // Get Url From Post Content function topclub_get_url_in_content( $post_id ) { $content = get_the_content($more_link_text, $strip_teaser, $post_id ); $has_url = get_url_in_content( $content ); return $has_url; } // Get Post Categories List function topclub_get_post_categoires( $post_id, $separator = ' ' ) { $output = ''; $post_categories = get_the_category( $post_id ); $post_categories_count = count($post_categories); $i = 1; foreach( $post_categories as $post_category ) { if ( $post_categories_count == $i) { $separator = ''; } $output .= '<a class="post-category-link" href="'. esc_url( get_category_link( $post_category->term_id ) ) .'">'. esc_html($post_category->name) .'</a>' . $separator; $i++; } return $output; } // Get Filtered Post Date function topclub_get_post_date( $post_id ) { $output = ''; $output = apply_filters( 'the_date', get_the_date( get_option( 'date_format' ), $post_id ), get_option( 'date_format' ), '', '' ); return $output; } // Get Post Content based on Post Format function topclub_get_archive_post_content( $post_id ) { $output = ''; $post_format = get_post_format( $post_id ); if ( !post_password_required() ) { if ( $post_format == 'aside' || $post_format == 'quote' ) { $output = get_the_content($more_link_text, $strip_teaser, $post_id ); } elseif ( $post_format == 'link' ) { $output = topclub_get_url_in_content( $post_id ); } else { $output = get_the_excerpt( $post_id ); } } if ( !get_the_title($post_id) ) { $output .= '<div class="read-more-link-wrap"><a href="' . get_the_permalink($post_id) . '" class="read-more-link">' . esc_html__('Read More', 'topclub') . '</a></div>'; } return $output; } // Get Widgets Page function topclub_remove_widgets_block_editor() { remove_theme_support( 'widgets-block-editor' ); } add_action( 'after_setup_theme', 'topclub_remove_widgets_block_editor' ); // Theme Pagination function topclub_pagination( $show_total = true, $pages = '', $range = 2 ) { $showitems = ( $range * 2 ) + 1; global $paged; if ( empty( $paged ) ) { $paged = 1; } if ( $pages == '' ) { global $wp_query; $pages = $wp_query->max_num_pages; if( !$pages ) { $pages = 1; } } if ( 1 != $pages ) { echo "<div class='pagination-wrap'>"; // First Page Link if( $paged > 1 ) echo "<a class='first-page' href='".get_pagenum_link(1)."'>‹‹</a>"; // Previous Page Link if( $paged > 1 && $showitems < $pages ) echo "<a class='prev' href='".get_pagenum_link( $paged - 1 )."'>‹</a>"; // Pages Loop for ( $i=1; $i <= $pages; $i++ ) { if (1 != $pages && ( !( $i >= $paged + $range + 1 || $i <= $paged-$range - 1 ) || $pages <= $showitems ) ) { echo wp_kses_post( ( $paged == $i ) ? "<span class='current'>" . $i . "</span>" : "<a href='" . get_pagenum_link( $i ) . "' class='inactive' >" . $i . "</a>" ); } } // Next Page Link if ( $paged < $pages && $showitems < $pages ) echo "<a class='next' href='" . get_pagenum_link( $paged + 1 ) . "'>›</a>"; // Last Page Link if( $paged < $pages ) echo "<a class='last-page' href='".get_pagenum_link($pages)."'>››</a>"; // Total Pages Text if ( $show_total ) { echo "<div class='pagination-total'>" . esc_html__('Page', 'topclub') . ' <span>' . $paged . '</span> ' . esc_html('of', 'topclub') . ' <span>' . $pages . "</span></div>"; } echo "</div>"; } } // Get Pagination Function function topclub_get_pagination( $show_total = true ) { $output = '<div class="wp-pagination-wrap">' . get_posts_nav_link( array('sep' => '') ) . '</div>'; if ( function_exists('topclub_pagination') ) { $output = topclub_pagination( $show_total ); } return $output; } // Set Excerpt Length function topclub_excerpt_length( $length ) { return 30; } add_filter( 'excerpt_length', 'topclub_excerpt_length', 999 ); // Set Excerpt Ending function topclub_excerpt_ending( $more ) { return '...'; } add_filter( 'excerpt_more', 'topclub_excerpt_ending' ); // Set AddToAny Share Buttons Location function topclub_a2a_share_location() { if ( !in_category( array( '' ) ) ) { return true; } } add_filter( 'addtoany_sharing_disabled', 'topclub_a2a_share_location' ); // AddToAny Share Buttons function topclub_a2a_share_buttons() { if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { echo '<div class="share-buttons-wrap">'; ADDTOANY_SHARE_SAVE_KIT(); echo '</div>'; } } // Include Customizer File require_once( get_template_directory() .'/inc/customizer.php' ); // Add WooCommerce Support function topclub_add_woocommerce_support() { add_theme_support( 'woocommerce', array( 'thumbnail_image_width' => 300, 'single_image_width' => 500, 'product_grid' => array( 'default_rows' => 3, 'min_rows' => 2, 'max_rows' => 8, 'default_columns' => 3, 'min_columns' => 2, 'max_columns' => 5, ), ) ); } add_action( 'after_setup_theme', 'topclub_add_woocommerce_support' ); // Change Number of Product Columns add_filter('loop_shop_columns', 'topclub_product_columns'); if (!function_exists('loop_columns')) { function topclub_product_columns() { $shop_columns_number = 3; if ( get_theme_mod('pages_shop_archive_columns', 3) != '' ) { $shop_columns_number = get_theme_mod('pages_shop_archive_columns', 3); } return $shop_columns_number; } } // WooCommerce Additional Settings add_action( 'after_setup_theme', 'topclub_woocommerce_setup' ); function topclub_woocommerce_setup() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } // Remove WooCommerce Breadcrumbs add_action('template_redirect', 'topclub_remove_shop_breadcrumbs' ); function topclub_remove_shop_breadcrumbs(){ if (function_exists('woocommerce')) { if ( is_shop() || is_product() ) { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); } } } // Get WooCommerce Star Rating if ( class_exists('woocommerce') ) { function topclub_get_product_star_rating() { global $woocommerce, $product; $average = $product->get_average_rating(); echo '<div class="star-rating"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'topclub' ).'</span></div>'; } } // Ajax WooCommerce Cart Count function topclub_cart_count($fragments){ if ( class_exists('woocommerce') ) { ob_start(); $cart_items_count = WC()->cart->get_cart_contents_count(); ?> <?php if ( $cart_items_count ) : ?> <span id="top-cart-quantity" class="cart-quantity"><?php echo esc_html($cart_items_count); ?></span> <?php endif; ?> <?php $fragments['#top-cart-quantity'] = ob_get_clean(); return $fragments; } } add_filter( 'woocommerce_add_to_cart_fragments', 'topclub_cart_count'); // TGM Plugin Activation require_once (get_template_directory() . '/inc/class-tgm-plugin-activation.php' ); add_action( 'tgmpa_register', 'topclub_require_plugins' ); function topclub_require_plugins() { $plugins = array( [ 'name' => 'CSA Top Club', 'slug' => 'csa-topclub', 'source' => get_template_directory() . '/inc/csa-topclub.zip', 'required' => true, ], [ 'name' => 'SportsPress', 'slug' => 'sportspress', 'required' => true, ], [ 'name' => 'Kirki', 'slug' => 'kirki', 'required' => true, ], [ 'name' => 'Max Mega Menu', 'slug' => 'megamenu', 'required' => false, ], [ 'name' => 'Smart Slider 3', 'slug' => 'smart-slider-3', 'required' => false, ], [ 'name' => 'Video Thumbnails Reloaded', 'slug' => 'video-thumbnails-reloaded', 'required' => false, ], [ 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false, ], [ 'name' => 'Add to Any Share Buttons', 'slug' => 'add-to-any', 'required' => false, ], [ 'name' => 'One Click Demo Import', 'slug' => 'one-click-demo-import', 'required' => false, ] ); $config = array( 'id' => 'topclub', 'default_path' => '', 'menu' => 'topclub-install-required-plugins', 'has_notices' => true, 'dismissable' => true, 'is_automatic' => false, ); tgmpa( $plugins, $config ); } // Add Mega Menu Theme function toplcub_megamenu_styles($themes) { $themes["top_club_main_menu"] = array( 'title' => 'Top Club Main Menu', 'container_background_from' => 'rgba(0, 0, 0, 0)', 'container_background_to' => 'rgba(0, 0, 0, 0)', 'menu_item_background_hover_from' => 'rgba(0, 0, 0, 0)', 'menu_item_background_hover_to' => 'rgba(0, 0, 0, 0)', 'menu_item_link_font_size' => '12px', 'menu_item_link_height' => '60px', 'menu_item_link_color' => 'rgb(155, 172, 187)', 'menu_item_link_weight' => 'bold', 'menu_item_link_text_transform' => 'uppercase', 'menu_item_link_color_hover' => 'rgb(255, 255, 255)', 'menu_item_link_weight_hover' => 'bold', 'menu_item_link_padding_left' => '15px', 'menu_item_link_padding_right' => '15px', 'panel_background_from' => 'rgb(255, 255, 255)', 'panel_background_to' => 'rgb(255, 255, 255)', 'panel_header_color' => 'rgb(51, 51, 51)', 'panel_header_text_align' => 'center', 'panel_header_font_size' => '14px', 'panel_padding_left' => '20px', 'panel_padding_right' => '20px', 'panel_padding_top' => '20px', 'panel_padding_bottom' => '20px', 'panel_widget_padding_top' => '5px', 'panel_widget_padding_bottom' => '5px', 'panel_font_size' => '14px', 'panel_font_color' => 'rgb(51, 51, 51)', 'panel_font_family' => 'inherit', 'panel_second_level_font_color' => 'rgb(51, 51, 51)', 'panel_second_level_font_color_hover' => 'rgb(239, 8, 14)', 'panel_second_level_text_transform' => 'uppercase', 'panel_second_level_font' => 'inherit', 'panel_second_level_font_size' => '12px', 'panel_second_level_font_weight' => 'bold', 'panel_second_level_font_weight_hover' => 'bold', 'panel_second_level_text_decoration' => 'none', 'panel_second_level_text_decoration_hover' => 'none', 'panel_second_level_padding_top' => '5px', 'panel_second_level_padding_bottom' => '5px', 'panel_third_level_font_color' => 'rgb(51, 51, 51)', 'panel_third_level_font_color_hover' => 'rgb(239, 8, 14)', 'panel_third_level_font' => 'inherit', 'panel_third_level_font_size' => '12px', 'flyout_menu_background_from' => 'rgb(255, 255, 255)', 'flyout_menu_background_to' => 'rgb(255, 255, 255)', 'flyout_padding_top' => '0', 'flyout_padding_right' => '0', 'flyout_padding_bottom' => '0', 'flyout_padding_left' => '0', 'flyout_link_padding_left' => '15px', 'flyout_link_padding_right' => '15px', 'flyout_link_padding_top' => '5px', 'flyout_link_padding_bottom' => '5px', 'flyout_link_weight' => 'bold', 'flyout_link_weight_hover' => 'bold', 'flyout_link_height' => '30px', 'flyout_background_from' => 'rgb(255, 255, 255)', 'flyout_background_to' => 'rgb(255, 255, 255)', 'flyout_background_hover_from' => 'rgba(0, 0, 0, 0.02)', 'flyout_background_hover_to' => 'rgba(0, 0, 0, 0.02)', 'flyout_link_size' => '12px', 'flyout_link_color' => 'rgb(51, 51, 51)', 'flyout_link_color_hover' => 'rgb(239, 8, 14)', 'flyout_link_family' => 'inherit', 'flyout_link_text_transform' => 'uppercase', 'shadow_color' => 'rgba(0, 0, 0, 0)', 'toggle_background_from' => 'rgba(0, 0, 0, 0)', 'toggle_background_to' => 'rgba(0, 0, 0, 0)', 'mobile_background_from' => 'rgba(0, 0, 0, 0)', 'mobile_background_to' => 'rgba(0, 0, 0, 0)', 'mobile_menu_item_link_font_size' => '14px', 'mobile_menu_item_link_color' => '#ffffff', 'mobile_menu_item_link_text_align' => 'left', 'mobile_menu_item_link_color_hover' => '#ffffff', 'mobile_menu_item_background_hover_from' => 'rgba(0, 0, 0, 0)', 'mobile_menu_item_background_hover_to' => 'rgba(0, 0, 0, 0)', 'custom_css' => '/** Push menu onto new line **/ #{$wrap} { clear: both; } #{$wrap} #{$menu} > li.mega-menu-item { &.mega-current-menu-item, &.mega-current-menu-ancestor, &.mega-current-page-ancestor { > a.mega-menu-link { color: #fff; border-bottom: 3px solid #EF080E; } } }', ); return $themes; } add_filter("megamenu_themes", "toplcub_megamenu_styles"); // Set Default Mega Menu Theme function topclub_megamenu_set_default_theme($value) { if ( !isset($value['main-menu']['theme']) ) { $value['main-menu']['theme'] = 'top_club_main_menu'; // change my_custom_theme_key to the ID of your exported theme } return $value; } add_filter('default_option_megamenu_settings', 'topclub_megamenu_set_default_theme'); // One Click Demo Import Settings function topclub_ocdi_import_files() { return [ [ 'import_file_name' => 'Soccer Demo', 'local_import_file' => trailingslashit( get_template_directory() ) . 'demo/soccer/topclub.xml', 'local_import_widget_file' => trailingslashit( get_template_directory() ) . 'demo/soccer/widgets.wie', 'local_import_customizer_file' => trailingslashit( get_template_directory() ) . 'demo/soccer/customizer.dat', 'local_import_preview_image' => trailingslashit( get_template_directory() ) . 'demo/soccer/soccer-demo-img.png', 'preview_url' => 'https://cyberspaceart.com/topclub/', 'import_notice' => __( 'You may notice some warnings while importing the demo content in case the WooCommerce plugin is not activated. Some additional actions required to make the theme match the live demo, please refer to the documentation.', 'topclub' ), ] ]; } add_filter( 'ocdi/import_files', 'topclub_ocdi_import_files' ); function topclub_ocdi_register_plugins( $plugins ) { $theme_plugins = [ [ 'name' => 'CSA Top Club', 'slug' => 'csa-topclub', 'source' => get_template_directory() . '/inc/csa-topclub.zip', 'required' => true, ], [ 'name' => 'SportsPress', 'slug' => 'sportspress', 'required' => true, ], [ 'name' => 'Kirki', 'slug' => 'kirki', 'required' => true, ], [ 'name' => 'Max Mega Menu', 'slug' => 'megamenu', 'required' => false, 'preselected' => true, ], [ 'name' => 'Smart Slider 3', 'slug' => 'smart-slider-3', 'required' => false, 'preselected' => true, ], [ 'name' => 'Video Thumbnails Reloaded', 'slug' => 'video-thumbnails-reloaded', 'required' => false, 'preselected' => true, ], [ 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false, 'preselected' => true, ], [ 'name' => 'Add to Any Share Buttons', 'slug' => 'add-to-any', 'required' => false, 'preselected' => true, ], ]; return array_merge( $plugins, $theme_plugins ); } add_filter( 'ocdi/register_plugins', 'topclub_ocdi_register_plugins' ); function topclub_frontpage_displays() { $fontpage_type = get_option('show_on_front'); if( $fontpage_type == 'page' ) { update_option( 'show_on_front', 'posts' ); } } add_action( 'after_setup_theme', 'topclub_frontpage_displays' ); ?> // add custom map <?php public function show_venue_map( $latitude, $longitude, $address, $zoom, $maptype ) { $lat = abs( $latitude ); $lat_deg = floor( $lat ); $lat_sec = ( $lat - $lat_deg ) * 3600; $lat_min = floor( $lat_sec / 60 ); $lat_sec = floor( $lat_sec - ( $lat_min * 60 ) ); $lat_dir = $latitude > 0 ? 'N' : 'S'; $lon = abs( $longitude ); $lon_deg = floor( $lon ); $lon_sec = ( $lon - $lon_deg ) * 3600; $lon_min = floor( $lon_sec / 60 ); $lon_sec = floor( $lon_sec - ( $lon_min * 60 ) ); $lon_dir = $longitude > 0 ? 'E' : 'W'; ?> <a href="<?php echo esc_url( 'https://www.google.com/maps/place/' . urlencode( "{$lat_deg}°{$lat_min}'{$lat_sec}\"{$lat_dir}" ) . '+' . urlencode( "{$lon_deg}°{$lon_min}'{$lon_sec}\"{$lon_dir}" ) . '/@' . $latitude . ',' . $longitude . ',' . $zoom . 'z' ); ?>" target="_blank"><div id="sp_openstreetmaps_container" style="width: 100%; height: 320px"></div></a> <script> // position we will use later var lat = <?php echo esc_attr( $latitude ); ?>; var lon = <?php echo esc_attr( $longitude ); ?>; // initialize map map = L.map('sp_openstreetmaps_container', { zoomControl:false }).setView([lat, lon], <?php echo esc_attr( $zoom ); ?>); // set map tiles source <?php if ( 'satellite' === $maptype ) { ?> L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', maxZoom: 18, }).addTo(map); <?php } else { ?> L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data © <a >OpenStreetMap</a> contributors', maxZoom: 18, }).addTo(map); <?php } ?> // add marker to the map marker = L.marker([lat, lon]).addTo(map); map.dragging.disable(); map.touchZoom.disable(); map.doubleClickZoom.disable(); map.scrollWheelZoom.disable(); </script> <?php }
Come devo provvedere a modificare il codice ?
Nell’attesa vi ringrazio
Hi!
Unfortunately, this kind of customization is beyond the scope of our support. We can help you with using the plugin’s features, but modifying it requires some coding knowledge.
I’ll leave this open in case Savvas or someone else from our community wants to help.
Thanks!
- The topic ‘Openstreetmap’ is closed to new replies.