Skip Navigation

[Resolved] Anchor to specific DIV ID or A NAME for each item in the view

This support ticket is created 5 years, 2 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Shane 5 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1333501

I'm trying to make an anchor to a specific DIV ID or A NAME for each item in the view, but it only shows the first item of the view.

THE IS THE HTML I WANT ON THE PAGE WHERE THE VIEW IS:


<a href="#first">FIRSTITEM</a> - <a href="#second">SECONDITEM</a> - <a href="#third">THIRDITEM</a>

THIS IS MY VIEW:


[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
          <a name="[wpv-post-slug]"><h3>[wpv-post-title]</h3></a>
          [wpv-view name="gerechten" wpvprchildof="[wpv-post-id id="$menu"]"]
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

THIS IS MY CHILDVIEW:


[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
		[wpv-post-body view_template="gerechtregel-template"]
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

THIS IS MY CHILDVIEW CONTENTTEMPLATE:


<div class="gerecht-item">
<div class="gerecht-item-links">
<h4 class="gerecht-item-title">[types field='naam-gerecht'][/types]</h4>
</div>
<div class="gerecht-item-rechts">
<div class="gerecht-prijs">[types field='prijs-gerecht'][/types]</div>
</div>
<div class="gerecht-item-onder">
[types field='omschrijving-gerecht'][/types]
</div>
 [wpv-conditional if="( $(wpcf-biertip) ne '' )"]<div class="gerecht-biertip"><span>Biertip: </span>[types field='biertip'][/types]</div>[/wpv-conditional]
</div>

#1333735

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Patrick,

Thank you for getting in touch.

Since you are doing this in a view loop. Then how you have it here is correct.


[wpv-layout-start]
    [wpv-items-found]
    <!-- wpv-loop-start -->
        <wpv-loop>
          <a name="[wpv-post-slug]"><h3>[wpv-post-title]</h3></a>
          [wpv-view name="gerechten" wpvprchildof="[wpv-post-id id="$menu"]"]
        </wpv-loop>
    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
        <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
    [/wpv-no-items-found]
[wpv-layout-end]

This below is also correct.

<a href="#first">FIRSTITEM</a> - <a href="#second">SECONDITEM</a> - <a href="#third">THIRDITEM</a>

However you will need to replace the href values with the slug of the posts. Could you send me a link the page so that I can have a look ?

Thanks,
Shane