I want to connect Google Map markers in a sequential line (A → B → C) without closing the loop back to the starting point (A).
Solution:
The issue arises when the last coordinate duplicates the first one, which closes the loop. The updated JavaScript provided ensures that if the first and last coordinates are identical, the last coordinate is removed to prevent the path from closing.
Here’s the corrected code snippet:
jQuery(document).ready(function($){
function initMap() {
var mapid = 'map-2';
var map = WPViews.view_addon_maps.get_map(mapid);
var markers = WPViews.view_addon_maps.markers[mapid];
if (markers.length === 0) return;
var tripCoordinates = [];
var latLng;
// Loop over all the markers and create an array of lat/lng objects
for (var marker in markers) {
if (markers.hasOwnProperty(marker)) {
latLng = {
'lat': markers[marker].position.lat(),
'lng': markers[marker].position.lng()
};
tripCoordinates.push(latLng);
}
}
// Remove the last coordinate if it duplicates the first coordinate
if (tripCoordinates.length > 1) {
var firstCoord = tripCoordinates[0];
var lastCoord = tripCoordinates[tripCoordinates.length - 1];
if (firstCoord.lat === lastCoord.lat && firstCoord.lng === lastCoord
You are unable to set the custom post type archive in Astra Pro to full width (1200 px) and cannot remove the restricted space for a sidebar.
Solution:
Use Astra's layout settings in the Toolset content template sidebar to adjust the layout.
- Open the Content Template for your custom post type archive in Toolset.
- In the right sidebar, look for Astra-specific layout options.
- Select the layout that allows full-width content and disables the sidebar.
- Save and check the changes on the frontend.
The custom post type "venue" displays a white background, unlike the "artist" custom post type, which has the correct background color. Attempting to reuse the "artist" template for "venue" does not fix the background issue.
Solution:
- Create separate Content Templates for the "artist" and "venue" custom post types.
- Assign a unique CSS class for each template in their respective settings.
- Add CSS to your theme to define the desired background color for each class.
Using a Toolset View within an Elementor Loop Grid displays all linked files for all posts, rather than only the files associated with the current post.
Solution:
Toolset Views and Elementor Loop Grids are not fully compatible. Instead, use a Toolset View for the loop and integrate it with Elementor via a shortcode.
Create a Toolset View for the Loop:
- Go to Toolset > Views.
- Create a new View to display your "Documents" custom post type.
- Configure the View to display the fields you need, ensuring it filters by the current post.
Add the Toolset View to Elementor:
- In Elementor, use the Text Editor or Shortcode widget.
- Add the shortcode for your Toolset View.
You want to link "Documents" (CPT) to "Events" (CPT) so that certain documents can be associated with specific events and displayed dynamically on an event's page.
Solution:
One-to-Many Relationship:
- Use this if each Document is linked to only one Event.
- Example: A single Document can only be associated with one Event.
Many-to-Many Relationship:
- Use this if a Document can be linked to multiple Events and an Event can have multiple Documents.
- Example: Shared resources like policies or templates across multiple events.