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
- How do test if a post is a custom post type?
- What is singular.php?
- Conditional for single-{post-type}.php
- What are the differences between custom post type and custom page templates?
- Page Template as Custom Post Type Archive
- Setting a custom sub-path for blog without using pages?
- Add Content to Page without shortcodes
- Loading custom page template via plugin
- 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?
- WordPress keeps fetching the archive page instead of the template page
- How to add custom template in plugin?
- is_singular() not working if called via callback function of admin-ajax.php
- How to quickly switch custom post type singular template?
- Add a Template to a custom post type
- How to use a dedicated template for the Custom Post Type from a plugin?
- functions.php conditional tag only for 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?
- Exclude custom function content from certain pages
- Assign Page Template Within A Custom Post Type
- Dynamic page.php template for custom post types
- Get template part based on custom taxonomy term
- Custom post type archive and single.php files not working
- Page Templates – this code only works for one Custom Post Type
- Pagination on a custom page template
- If on term-page -> get the current term?
- Custom Post Type – Archive page title
- WordPress custom post type Single.php?
- Multiple templates for custom post type
- custom post type upcoming post and past post
- How do I create a custom post type for a training CMS in WordPress?
- changing default comment form arguments [duplicate]
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- How do I create a page template to display a custom post type?
- How to make an archive page displaying posts in a date range
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Custom Post Type slug same as page name causing a conflict
- Control Custom Post Type template from a plugin
- Detect if 1st, 2nd or 3rd level custom page?
- Create second custom 404 page for selected 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
- Hyphens instead of Underscores in Post-type Archive Template Filenames when Post-type handle contains underscore
- Including Custom Post Type posts in a page template contextually (or should I widget?)
- Help with CPT template pagination
- Custom Blog Post Listing in Genesis Sample Child Theme
- After updating a page, all pages on the site used the index.php template
- Page Templates Drop Down Select for Custom Post Types
- remove child post from custom post type archive
- Pull in custom content types into page template
- Editable content on a Custom Archive page
- Using custom page templates with plugin [duplicate]
- Can I make WordPress use a custom template for a child page
- if custom posts type exists and there are posts load script
- 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
- Create Template for Custom Post Type same like for Page
- Excluding custom post types
- Creating a Page to View the List of Posts for a Custom Post Type?
- How to load a template without it being assigned to a page/post?
- Change archive page template using pre_get_post
- Custom template with CPT doesn’t display on frontend
- Custom Page that comes with preloaded content for the user
- create a template page for a post
- Custom post type archive page template
- Custom Post Type with Templates using Meta Boxes?
- Posts are duplicating on wp_post_update
- Custom-Posttype & Custom Taxonomy WP_Query
- Page template with different page and post content
- Custom page sidebar using Template dropdown box
- 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
- How to render a custom post type template with custom fields using shortcode
- Show Custom Post Type meta boxes only on Page Edit
- Adding the_content() in custom template email
- 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 Type Template Alternative
- Custom Post Conditional for Parent & Child Single.php?
- General advice on addressing content-centric pages
- Fields for different parts of a page
- next_/previous_post_link() `in_same_category` appears to fail when true
- 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?
- WordPress Custom Search by post_type