Doh… While writing up this question it suddenly became clear why it was not working:
I was hooking my buttons inside the loop and since my loop was not a single page item, get_the_id() would be getting the ID of each post in the loop, not the page that the posts were on.
All I had to do was hook after the loop:
add_action( 'genesis_after_loop', 'my_page_buttons');
I’m posting this just in case someone else has a similar issue.
Related Posts:
- is_page_template not working as expected
- What are the differences between custom post type and custom page templates?
- Setting a custom sub-path for blog without using pages?
- Post formats “audio” and “video” only showing in index.php
- Ordering Posts List By Taxonomy Terms?
- Creating a Custom Post Type for Inserting Preset Content into Post & Pages?
- How to add custom template in plugin?
- How to quickly switch custom post type singular template?
- Add a Template to a custom post type
- WordPress calls archive page instead of Custom Page Template
- How do I Make a custom post type get a custom post template in a plugin
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Dynamic page.php template for custom post types
- Get template part based on custom taxonomy term
- Pagination on a custom page template
- Multiple templates for custom post type
- changing default comment form arguments [duplicate]
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- How to make an archive page displaying posts in a date range
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Child page in custom post throws 404 page not found
- CPT: archive-cpt.php VS custom page template
- Multiple portfolios with one custom post type?
- Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template
- Including Custom Post Type posts in a page template contextually (or should I widget?)
- Custom Blog Post Listing in Genesis Sample Child Theme
- Pull in custom content types into page template
- Editable content on a Custom Archive page
- Troubles with making a custom template for posts
- Need help targeting a custom post type with conditional tags
- Why would this IF statement not work? [closed]
- custom comments on specific post type
- Creating a Page to View the List of Posts for a Custom Post Type?
- Change archive page template using pre_get_post
- Custom Page that comes with preloaded content for the user
- Register widget only page is a singular of custom post type
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Conditional Query of Custom Post Type and custom taxonomy
- redirect automatic page that serves custom posttype content
- Adding sidebar to template creates horizontal gap the size of the side bar
- WordPress showing archive.php instead page
- Show Custom Post Type meta boxes only on Page Edit
- Creating a Page Template to display all items from a Custom Post Type
- Filter widget outputs
- Why does my content disapear when I make a page to match an archive name?
- How to run filter only on custom post type edit screen
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom Post Conditional for Parent & Child Single.php?
- Fields for different parts of a page
- Multiple templates for single custom post type
- How do you create a custom template to display a category with an image and related posts below?
- How can I set the page template of a new custom post type post?
- How to show only the most recent post on my custom post type archive?
- WordPress Picks Up Wrong Template for Custom Post Type Archive Page
- Associate page w/ specific single post template?
- get comments by current user inside page template
- Move Genesis Single Page/Single Post Title
- page template for custom post type
- Display message if no posts in Custom Post Type loop
- Custom page for editing custom post type on frontend based on url
- Dynamic assign a custom template to custom post type posts
- How do I display child post types in the parent post type template
- How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
- How to add page under a custom post type?
- Custom permalink structure for remote content pages
- Redirect to URL if x number of days passed
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- Display custom post type from template
- Problem with custom loop navigation inside the blog page
- WordPress giving me the index
- How to use pre_get_posts on archive page custom post type
- How To Display Posts Of Custom Post Type At Page Template
- How to change Elementor Template for Single Page Post on Load
- A certain theme is forcing it’s singular post layout
- How to create additional rendering for custom post types?
- How do I find out which (page) template file my custom child post is looking for?
- Set a template on a custom post in the plugin
- How can I use one instance of page.php to display different custom post types?
- Question on templates
- Custom post type option page template
- Custom post Query and WordPress Post Query Clash
- How can I load Template file from wordpress plugin
- How to display a custom post as a page (but unedited)?
- How can I find out what template is my custom post type using?
- Search custom post type result in same template page
- Custom post type , page template not grabbing the page template
- custom post type archive slug vs. custom page template
- How to create a custom template for this custom post type?
- Nested custom post types templating
- Custom Post Type & Page Template
- How to divide posts (custom post type) content on multiple pages?
- Diffrent search templates for different post types
- Conditional Tags If Custom Post Parent & Child?
- How do I paginate a custom post type listing on a custom template page?
- Custom Post Type order Title ASC
- Page template anomaly
- Custom Post Type Template Based on Page Slug?
- Conditional statement checking two conditions for CPT and Custom Taxonomy [closed]
- display related posts based on the PAGE TITLE