Skip Navigation

[Resolved] Pagination, Maps, Templates

This support ticket is created 2 years, 1 month 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 14 replies, has 2 voices.

Last updated by Waqar 2 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2309769

Tell us what you are trying to do?

While I was able to resolve my data showing as a grid, Now I am having issues, making the pagination work reliably. It disappeared, and secondly having trouble making the template and the views show the correct data.

I've tried setting the content selection to show the posts relative to the archive page its on, this doesn't work. I've also tried duplicating the templates, and manually adjusting which content it is supposed to show, but when I change one template, it changes them all. I am very frustrated and need help.

Lastly many of your support articles regarding any of these matters render 404 not found errors.

Each of the following archives have separate content templates set to show the content that corresponds to the archive, but when I change one template it changes the content for all. (Again created separate templates for each each with their own views):

{links removed}

Also, trying to use the map feature - which this client wants- the toolset template and map block recognizes the custom post type "Listings" but per your article, does not show it's custom fields, hence I cannot select the "address" field that is part of that CPT and even try to display the map markers for these listings.

#2309953

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

To troubleshoot and assist you with these points, I'll need to see exactly how these archives and the content templates are set up in the admin area.

Can you please share temporary admin login details, in reply to this message?

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2310565

Hi Waqar,

Can you also help me with formatting of dates in Custom Fields that are pulled in by Toolset?

adding in

format='F j, Y'

for the desired format within the WPV field is not working.

The content at the top of the page including start date, end date, entries open/close is using fields from Toolset to show dynamic content, but they are not coming through formatted. I cannot find an article to help.

Link to page:
{link removed}

Example of my code using the [wpv-post-field-name=''] to show the data.

<div class="entry-header-custom-wrap">
<p class="event_start"> Start Date: <br/>[wpv-post-field name='_EventStartDate']</p>
<p class="event_end"> End Date: <br/>[wpv-post-field name='_EventEndDate']</p>
</div>

<div class="entry-header-custom-wrap">
<p class="event_open"> Entries Open: <br/>[wpv-post-field name='enteries_open']</p>
<p class="event_close"> Entries Close: <br/>[wpv-post-field name='entries_close' format='F j, Y']</p>
</div>

Thank you for your help.
Kasia

#2310951

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details.

I'll be performing some tests on my website with a similar setup and will share the findings, as soon as this testing completes.

Thank you for your patience.

#2312137

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting, while I reviewed your website's setup.

I noticed that you're using the theme's "Elements" feature to include the 3 Toolset's content templates inside these 3 archive pages. And inside these content templates, you've used the same post view "Listings - Accommodations" to show the listings posts.

Is there any specific reason for using this indirect approach for these archives, and not using the Toolset WordPress Archive feature?
( ref: https://toolset.com/course-chapter/designing-the-archive-for-directory-items/ )

You can create a single WordPress Archive for the taxonomy "Listing Category" and it would've automatically worked for all its terms, like "Accommodations", "Food & Dining", and "Shopping & Gifts" etc.

As for the date formatting, the "wpv-post-field" shortcode ( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-field ) is useful for getting the custom field values that use generic text data, as it can return only the raw values saved in the database.

The challenge here is that these 4 date fields that you referring to are not added using the Toolset Types plugin. If they were the date type field from the Types plugin, outputting them in the desired format was very straightforward, using its shortcode:
https://toolset.com/documentation/customizing-sites-using-php/functions/#date

The "enteries_open" and the "entries_close" fields are added using the "Advanced Custom Fields" plugin, so you can try using its own shortcode "acf":
( ref: hidden link )


<p class="event_open"><strong>  Entries Open: </strong><br/>[acf field="enteries_open"]</p>
<p class="event_close"><strong>  Entries Close: </strong><br/>[acf field="entries_close"]</p>

The fields "_EventStartDate" and "_EventEndDate" are managed by the "The Events Calendar" plugin and I couldn't find any information online about its recommended shortcode/function to show the formatted dates. To get the most accurate and up-to-date information about these fields, it would be best to consult "The Events Calendar" plugin's official support.

#2312159

Can you help provide one or two examples of the directory structured correctly so that I can follow for the others?

One of the reasons I structured it this way with the elements is because the blocks feature is difficult to use and it seems to lose my work. It autosaves and then seems to get confused when I actually hit update.

Also, I was never able to get the maps feature to work to display the listings.

Lastly, why did the pagination stop showing as well?

I hope you can look at this soon. Thank you again.

#2312949

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

I noticed that you've set the WordPress Archive "listings-archive", for the "Listings" post type archive and the "Listing Categories" archive.

That WordPress Archive was incorrectly set to use the classic editor and it was not possible to edit any of its settings. I've switched it back to use the blocks editor.

The pagination was not showing in those 3 archive pages, because it was set to show '20' items per page and none of those archives have more than 20 items, for the pagination to show.
( screenshot: hidden link )

I've changed those settings to '10' items and you can see the pagination now on the archive for the "Accommodations" term, as it has more than '10' items.
( /listingcategory/accommodations-lodging-near-gmha/ )

Note: You'll see two navigations on the page, one from the Toolset archive and the other from the theme. You can disable the theme's navigation, from the theme options settings.
( screenshot: hidden link )

I've also added a "Map" block on the top of the archive and the map is now showing on the front-end. To show the listing markers on this map, you'll need to add an address type custom field using the Toolset Types plugin, to the listings post type:
https://toolset.com/lesson-placement/lesson-placements-1620889-1620037/#add-the-address-custom-field
(The 'address' field that is currently added is being managed by the "Advanced Custom Fields" plugin and not Toolset)

Using the Types address field will be much more efficient because it stores the actual lat/long attributes of a location, which has performance benefits and is also cost-efficient (since fewer requests will be made to Google's Maps API).

#2313567

Thank you for your help Waqar .

Is there any issue using an Advanced Custom Field (ACF) and a Toolset Custom Field in the same Custom Post type?

Note: regarding the mapping feature.... I removed the map you added. I can add back in on my own. I needed to make the current iteration of the site live today, so I removed the map feature just prior to cloning it to the live environment.

I plan to configure the map function next, but couldn't delay with going live. I expect I will need to adjust the data a bit before it all works too.

While the "stage" site is ok to make adjustments to again and it won't affect live. Just need the answer to my question regarding the mixed custom fields.

Thank you!

#2313959

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Glad I could help!

> Is there any issue using an Advanced Custom Field (ACF) and a Toolset Custom Field in the same Custom Post type?
- Technically, no there is no issue in using Advanced Custom Field (ACF) and Toolset Types custom fields in the same custom post type.

However, in terms of usability, it would be a good idea to use Toolset's custom fields whenever possible, because, Toolset's own blocks and features (like search and query filters in views, user and post forms, shortcodes, etc) are designed to work with the Toolset's Types custom fields.

Other plugins like Advanced Custom Field (ACF) can store their custom field data in a different format, which makes those fields unusable with the Toolset elements listed above.

#2314649

Ok Thank you again Waqar,

I think I have just a couple of final questions.

Per your advice, I added the Toolset Custom Field for the map. It is powerful. A bit of work to adjust the data but worth it.

I am having trouble finding how to display the actual address that is stored in the Toolset maps custom field in the pop up container. I expect my client will like this, or perhaps a link in that box to the business listing site.

Can you provide an article or some example short codes? On my staging site I got it working minimally. Then got it working on my live site.

{link removed}

i would like the Toolset Map custom address to display like this"

123 Street
City, State, Zip (no country)

Because of the way my theme is set up, I wish to add the map that would show all the markers in an archive such as:

{link removed}

But have this design:

{link removed}

I would like to do this with a toolset shortcode so I can include it in a GeneratePress element to display full width no matter the screen size. Is there an article you can point me to to construct this? I don't want to add it to the archive itself, it won't have the full-width design I need, and I find editing the toolset archives or any of the toolset templates creates spikes in the hosting resources and the display and causes the toolset views to break quite often.

Thank you again,

Kasia

#2316383

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

When working with shortcodes, adding a map and the map markers consist of two main parts:

1. Shortcode for the map:

The "wpv-map-render" shortcode is used to generate the map and you can place it in the GeneratePress element, for example:


[wpv-map-render map_id="map-1"][/wpv-map-render]

You'll find the information about all the options/attributes that this shortcode supports at:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render

2. Shortcode for the map markers:

After the map has been added, you'll need the "wpv-map-marker" shortcode, that will plot each map marker on the map. For example:


[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-post-address']
[wpv-post-title]<br>
[types field='post-address'][/types]
[/wpv-map-marker]

The above shortcode will get the address information from the address type field "post-address" and generate the map marker for it, on the map with the "map_id" of "map-1" on the page.

When we need to generate multiple map markers for the results coming from the view or WordPress archive, it is important that the map marker shortcode is placed in the loop of the view or archive, so that it can repeat for each result.

You'll find the information about all the options/attributes that this shortcode supports at:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

Please also note, that any content that is placed between the opening and closing "wpv-map-marker" shortcode is displayed inside the map marker popup that opens when the marker is clicked.

In this example, I've only placed the current post's title shortcode '[wpv-post-title]' and types shortcode '[types field='post-address'][/types]' to show the address stored in the address type field "post-address", but you can use any Toolset shortcode to show the current post's data:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/
https://toolset.com/documentation/customizing-sites-using-php/functions/

#2317611

Hi Waqar,

Thank you for your continued help. I look forward to building a site from scratch one day just using toolset, with out mixed Custom Fields and Custom Post types. I expect that would really make all of this a lot easier.

Nonetheless I am still having issues. I was able to put the following code into my Generate Press Element which is in the loop for this archive. I tested it in its current location, after the header, as well as before the main content. Either way, while the map loads with the desired full-width look, the map markers did not work, can you help me figure out what I am missing?

I tried this code:

Test (just to test the hook, it renders)

[wpv-archive-title] (just to test the hook, it renders, as does the map below, just not the map markers from the archive listing)

[wpv-map-render map_id="map-listings" map_height="500"]
[wpv-map-marker map_id='map-listings' marker_id='marker-[wpv-post-id]' marker_field='dynamic-map']
[wpv-post-title]
[types field='dynamic-map'][/types]

[/wpv-map-marker]
[/wpv-map-render]

So while it is rendering a map on this archive:

{link removed}

It is not incorporating any map markers. I used a Toolset field for the map addresses. The first 4 listings on this test page in our staging/development site have the correct toolset field for testing purposes.

The Toolset custom field group is called "listings" the map address slug is "dynamic-map".

Toolset Custom Fields have data in the following listings:

{links removed}

Name of my Generate Press Element Hook:
Test Aggregate map

One final thing to add, I'm using a custom post type that was NOT created in Toolset, as this was a redesign and that custom post type is called "listings" and the field for it is simply "listing" i tried this as well, and neither worked in the types section.

#2318461

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

There are a couple of things that were implemented incorrectly:

1. The map marker shortcode "wpv-map-marker" shouldn't be nested inside the map shortcode "wpv-map-render".
( screenshot: hidden link )

2. I added this point in the last reply:

"When we need to generate multiple map markers for the results coming from the view or WordPress archive, it is important that the map marker shortcode is placed in the loop of the view or archive, so that it can repeat for each result."

The information about the posts/results coming from the archive is not available in the Element "Test Aggregate map", so adding the shortcode for the map marker won't be useful in it.

I've removed the map marker shortcode "wpv-map-marker" from that Element and placed it in a new "Fields and Text" block in the archive's "WordPress Archive Loop" block and the markers are now showing on that archive page.
( screenshot: hidden link )

#2318545

Ahhhhh, I understand now. When you stated "loop", I incorrectly assumed the "archive loop" of WordPress .vs the Toolset loop. .

I will give this a try but am highly encouraged this will be resolved and I will now be a Toolset map expert. Thank you for putting me on the path to success.

Also would you be so kind as to hide the links in my reply: #2317611? Thank you! I would prefer they do not get indexed by Search Engines.

#2319561

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Please take your time and glad I could help.

I've removed all your website's links from all replies in this thread.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.