My suggestion would be to use a custom page template. In your functions file you require a php file that contains the custom template.
require_once 'buy_page_template.php'
;
and that file declares itself to be a template by containing some commented out text:
<?php
/* Template Name: Buy Page */
Once you’ve uploaded and required that file, a new template appears as a possibility in all your pages in WordPress. You just set the page “buy” to use that template. You can put all the PHP you want into that template, and access the GET variable coming in just like you saw in the other question you cited.
What I do is copy and modify a template file from the theme I’m using.
Related Posts:
- Remove query string specific key value
- Modifying WP URL handing code?
- How to get URL of current page displayed?
- How do I use WP_query with multiple post IDs?
- Query multiple custom post types in single loop
- Best Practice for PHP
- Include WP_Query in my own PHP file?
- Encode text string being appended as query to URL [closed]
- Is it safe to use $_SERVER[‘REQUEST_URI’]?
- Inject post (from specific category) between posts in Loop
- The correct method to pass query vars in AJAX using ajaxurl
- is_page() not working from within a plugin
- How to check if feed URL was requested?
- What is the best practice for escaping data URIs?
- Build a content and excerpt grid loop with paging and options for # of posts
- urlencoding of the_title() doesn’t work?
- retrieve thumbnail from post ID of best selling product in category
- How do I get the author’s page url from their ID?
- Dynamic URL to reference custom PHP files
- How to create a WP_Query to search the Title or Tag?
- WP_Query | Help me create a search term with an ‘OR’ relation?
- Passing JSON data from WP Query into AJAX causing NULL errors
- Using Cookie Data For WP_Query Loop
- AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely
- wp_delete_post deletes all posts instead of just expired ones
- Display certain amount of posts on taxonomy archive page
- How to change featured content to a different tag in WordPress Twenty Fourteen?
- Alter secondary loop to exclude posts from current page category
- Result of Custom WP_Query appears on 404 Page (but result are found!)
- Show only one post for each author ( Page loads too slow )
- Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?
- how to display active, upcoming and past event with featured listing with pagination
- How to add 2 posts under another post? Formatting should be intact
- Trim first 2 words of the exceprt
- Get list of WP Updates Across Sites
- what is diference wp_get_attachment_url / wp_get_attachment_src / get_post_thumbnail_id?
- Modern Tribe Calendar wp-query with meta query not working at all
- if statement on database query
- WP_Query use for a filter with multiple Taxonomies and Terms
- Concatenate site_url and string doesn’t work
- What’s the proper way to use wp_enqueue_script/style?
- Duplicates with WP_Query loop
- Callback URL in WordPress
- WP_Query meta_query results date by date
- Count number of published posts by type
- How to display custom field on homepage
- Display Post co-authored in Author Page
- Wrong links in WordPress?
- Newbie question: no index.php? in my plain wordpress permalink
- WP_Query sort using multiple numeric meta values
- Can an array be used as a meta_query value?
- Display related products with custom output
- Help with adding pagination to custom wp_query
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- Can’t increase posts_per_page by variable
- How do I dynamically generate args for wp_query?
- How is WordPress manipulating the posts like there are folders?
- WordPress WP_Query() Not working properly
- Sorting Posts | Alphabetical Order
- Get taxonomy terms only of the WP_Query current posts
- How to get to a specific position in wp_query?
- Get category name from custom loop and echo it once
- Looking for most performant way to execute several similar WP queries within shortcodes
- API response to be stored locally
- Use wp_get_recent_posts with search term
- WP_Query loop, does not display special characters in title correctly
- Extract subdomain and relative address from a url
- Hide post if matches current month and year
- Set post title based on first h2 element in the content section
- Get the last month with posts using a recursive function…
- Use WP_Query in shortcode
- have_posts() execution failure
- Echo URL of large version of Featured Image
- Custom URL parameters in template files
- Why does WordPress remove my variables in the URL?
- How to filter posts by post format “standard” from wp-json api?
- Why is variable not working on custom sql query using wpdb?
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Can’t search posts using WP_QUERY inside AJAX Function
- How to query for pages/post depending on slug?
- How can I use wp_query to show all product data using just the products ID?
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Random order of WP_Query results with highest meta value
- Custom page archive query by url var calling page twice on one of my custom queries?
- WordPress custom slug (endpoint) and compare all links
- How to query for posts with a null or blank post_name?
- WordPress pagination not working with search page
- get current custom post ID by WP_Query method
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Using foreach loop breaks
- Overwriting a Shortcode
- How to get category pages to look like a certain archive page?
- show/hide attachments
- Magento and WordPress URL integration [closed]
- Post Title Not showing up
- Advanced Taxonomy query, with 3 post types
- WP Query conflict on tag.php and category.php template
- Passing multiple variables through url (php)
- reorder a WP_Query, using a dropdown
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list