Skip Navigation

[Resolved] Add map and listings to a page using views or shortcode

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 3 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#2309793

We would like to have the ability to add listings from a custom post type and taxonomy to a page using views or shortcodes. For example, we will have a /wineries information page where we will have some content.

Then, we have a custom post type called Activities with entries. We also have a taxonomy term called Wine. We have created a WordPress Archives view here: hidden link which displays the map and listings. However, we would like to be able to display this map/grid of places on a static page using Toolset (views or shortcodes?). I have looked through the documentation, but cannot figure out how to get this to work.

Thank you for the support. Dan

#2309935

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I think this is the Doc you are looking for:
- https://toolset.com/course-lesson/displaying-a-list-of-posts-on-a-map/

Can you please go through the steps offered with the above Doc and let me know if you will require further assistance.

#2311719
Screen Shot 2022-03-08 at 4.12.48 PM.png

Very helpful, thank you. A couple followup questions:
1 - We have a thumbnail size with cropping setup we'd like to use. We set this up in functions.php
add_image_size( 'archivethumb', 500, 350, true ); // Hard Crop Mode
To use images at this size, do I need to use the custom size selection in the image block settings? If I do this, does it add another set of thumbnails to the site files? I ask in the interest of trying to conserve space and keep load times fast.

2 - We need to randomize the output of the loop in order to make sure each business gets equal representation. I have set the ordering to random, but it is the same order on every page load. How do we make it random with each page load or browser session?

3 - We are using a custom post type "Activities" for Toolset WordPress Archives and Views. How do we exclude the default Posts post type from getting queried? We are using Posts for our blog and do not want them to show up in the map directories. I found something like this but it isn't working
//exclude posts from maps
function exclude_cpt( $query ) {
if ( $query->is_category() ) {
$query->set( 'post_type', 'post' );
}
}
add_action( 'pre_get_posts', 'exclude_cpt' );

Thanks again.

#2312211

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

1 - We have a thumbnail size with cropping setup we'd like to use. We set this up in functions.php
add_image_size( 'archivethumb', 500, 350, true ); // Hard Crop Mode
To use images at this size, do I need to use the custom size selection in the image block settings? If I do this, does it add another set of thumbnails to the site files? I ask in the interest of trying to conserve space and keep load times fast.
===>
To have your custom image site available as selection with image block dynamic source, you have to register its name. You can register its name using the following filter. You can add the following filter code to your theme's functions.php file:

add_filter( 'image_size_names_choose', 'func_custom_image_sizes_registered_for_dynamic_source_option' );
  function func_custom_image_sizes_registered_for_dynamic_source_option( $sizes ) {
    return array_merge( $sizes, array(
        'archivethumb' => __( 'ARCHIVE THUMB' ),
       
    ) );
}

- You can rename the name of your custom size as per your requirement instead of "ARCHIVE THUMB".

Once you add the above filter to your funcitons.php file, remove the image block and save your post/page/content template and then try to refresh it and then try to add the image block and you should be able to see that the registered name should be available as option.

2 - We need to randomize the output of the loop in order to make sure each business gets equal representation. I have set the ordering to random, but it is the same order on every page load. How do we make it random with each page load or browser session?
3 - We are using a custom post type "Activities" for Toolset WordPress Archives and Views. How do we exclude the default Posts post type from getting queried? We are using Posts for our blog and do not want them to show up in the map directories. I found something like this but it isn't working
==>
As per our support policy, we entertain only one question per ticket. Please kindly open a new ticket with every new question you many have this will help other users searching on the forum as well as help us to write correct problem resolution summery.