What you wanna do is use the name attribute.
<a href="#my-anchor">Link to the anchor</a>
<p name="my-anchor">This is the anchor</p>
Also, I would use something consistent, like the post/page slug to be able to link to each section.
<?php global $post; ?>
<div class="guide-section" name="<?php echo $post->post_name; ?>">
And then for your list use the slug as well. Repeat the while-loop:
<?php if( $bedGuideRight_query->have_posts() ){
while( $bedGuideRight_query->have_posts() ){
$bedGuideRight_query->the_post(); ?>
<a class="list-group-item" href="#<?php echo $post->post_name; ?>"><?php the_title(); ?></a>
<?php }
} ?>
Related Posts:
- How to handle a custom form in wordpress to submit to another page?
- How to display multiple Post meta_key/meta_values by SQL query
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to make an meta_query optional?
- How to use multiple query with same meta key
- Getting movie and serial on actor page
- How to loop over custom fields in a page template?
- Match checkbox data with page title to show certain items
- Geocoding an Exploded Custom Field Array
- How can update custom meta for all posts
- Unique key for each row in a repeater field
- Removing WordPress profile fields from non-admins
- Use ajax to update_post_meta
- WooCommerce: update custom fields after checkout validation failure
- If Meta Checkbox is checked, do something?
- Show custom field if it exists, and show different elements if it doesn’t
- Custom field value not saving when it contains a URL?
- tracking number field in Woocommerce order [closed]
- How can I create a list of page titles from custom meta values?
- Sort posts by custom fields value using dropdown menu
- WordPress – Display array data of a child
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- Need Help Fixing My Iframes [closed]
- Adding number to date not working [closed]
- Saving and Restoring a Canvas on A Individual User Basis
- How to use thumbnail size of image if I’m only using src to get image
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- how to retrieve a value if a checkbox is checked
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Add / Update Custom Fields After Select Pictures in Media Window
- Trying to retrieve post meta
- Custom Field IF/ELSE PHP
- How to combine 2 php functions into one function with a custom field
- Remove the last X characters of a custom field value
- Advanced Custom Fields – display label and value only if value entered
- Is it possible to retrieve all posts with a certain value for metadata?
- Saving zero in meta box
- Why does this update_post_meta function not delete the custom field itself?
- Run str_replace on title and save the output to a custom field
- WordPress loop by meta key that is an array? and how loop multiple arrays
- if custom field doesn’t exist, use post thumbnail instead, as image background
- WP All Import / Update stock quantity from multiple XML files
- How to store multiple custom meta box
- Concatenate Custom Field Value & HTML Value
- `update_post_meta` not working anymore
- Define category ID using get_post_meta
- Hide a div when a custom field is empty
- Comparing Dates from custom field
- Adding custom url to readmore link using get_permalink()
- Filter unique custom field value based on custom taxonomy category or other custom field
- Display movies that apear this day next
- Add “alt” Attribute to GD Star Rating Tags
- Display background color or image with custom meta box?
- custom header text
- Using a string from a custom field within a link
- Can ‘Custom Field’ data be inserted into this Short Code?
- Query pulling a single post per month
- Make separate text boxes for separate WordPress Custom Fields
- Add custom fields from different posts
- Delete images from media library when user deletes an image from ACF Gallery
- Adding a custom meta field with default NULL value which is not selectable
- Order category posts by last word of custom field
- Products listing check if meta checkbox is checked
- How to update custom fields when post is published?
- Block error message in foreach loop when looping through ACF field
- Hide a div if the fiels is empty
- Inserting a class on before_widget if checkbox is checked
- Where does php code to load data go?
- What is the correct way to search 3 custom fields only in WordPress?
- wp_get_nav_menu_items() with ACF
- Sum All the Post Meta of Published posts of Current Logged in user
- How do I get the value of a current user’s custom field?
- When working with a post, almost all wp_postmeta are deleted
- How to display custom field from a gallery thumbnail?
- How to use something like meta_query but for fields?
- Getting a value from a custom field from a page that shares a parent with the current page
- php if, else & custom fields – syntax error
- custom field meta-box with dropdown/autocomplete
- If custom field doesn’t exist, or exists and it’s true show title?
- Outputting a custom field in PHP
- Sorting Meta Fields?
- Custom fields randomly stop working
- Display selected parts from selected pages on the frontpage?
- Where can I find the code for the menu page meta boxes?
- How to echo a different field if another field is empty?
- PHP Puzzle: Unique Styles with PHP loop
- Metadata on the WP_Post object
- Appending an ACF custom field to the page title
- Advanced Custom Fields Show PHP in Text Areas
- WP query with variables gives no result for specific user
- Displaying custom meta box value in a custom post page
- Convert custom field date format to “WordPress default”
- How do you create a front end form that enables the editing of member-specific custom fields in WordPress?
- How to execute a shortcode within a custom field?
- Problem with custom user fields default value and retrieval
- Cannot Access ACF Field Values via my Plugin
- How to create advanced custom fields for backend content
- Allow HTML in custom taxonomy description, and show it on front end