<?php
/*
Template Name:product
*/
get_header();
// check if product_id is not set or is empty string
if( !isset($_GET['product_id']) || '' == $_GET['product_id'] ) {
// if so, run your query and display data
$data = $wpdb->get_results("myquery Here");
foreach($data as $row) {
echo '<div>';
echo '<p>Name:' . $row->p_name . '</p>';
echo '<p>Price:' . $row->p_price. '</p>';
// pass ID using GET
echo '<p><a href="https://wordpress.stackexchange.com/questions/74298/?product_id=" . $row->p_id . '">VIEW PRODUCT</a></p>';
echo '</div>';
}
}
else {
// product_id is set and is not empty
require('/path/to/view_detail.php');
}
get_footer();
Related Posts:
- How to *remove* a parent theme page template from a child theme?
- How to Change 404 page title
- How to redirect WordPress home page to custom static HTML page
- How can I create an alternative home page?
- page_template toggle between 2 templates + 2 permalinks for same post
- How do I deque the default stylesheet?
- Woocommerce Product page edit
- For custom templates, is it better to use `template_include` or `type_template`?
- Javascript Solution Remove Specific Tag but leave the rest in a specific DIV
- need help with a user-specific custom page template
- Prepopulating a specific page template with HTML/CSS
- custom meta box for page default template
- List top 5 authors with most posts
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- How to create custom search page
- WordPress archive index page
- How to create a custom WordPress front page
- Custom Same Page Search
- change top banner content on specific page
- How To make Custom page of every Category
- Remove Sidebars from page
- Product page not found if product data is set Appointment Service
- Page with some post value id showing page not found
- Why does a custom php code inside a custom template not get executed?
- How to use the same custom page template to iframe multiple urls with entry of new url entered from backend
- Create page when a new site in multisite network is created?
- Custom stylesheet not loading
- Displaying Child Page’s Information
- Adding pages to the Admin panel
- Setting Custom WordPress “Posts page” AS “Front page”
- Page template with custom html fields inside a content
- Single page template
- Adding page Title in a custom coded page
- use another theme for just one page
- Custom maintenance page
- How to customize the default HTML for WordPress Attachments
- Customizing the Subject Field in WordPress’ Notification Emails?
- How to move wp-content (or uploads) outside of the WordPress directory
- How can I integrate pages written in something other than PHP?
- Custom field values in permalink
- Redirect to requested page after (custom) login
- Custom protected password page with ACF
- Page load requires a trailing “/” [closed]
- Custom Dashboard Home Screen Options
- dynamic external javascript generated using php
- Show Custom Taxonomy Slug(s)?
- What’s the proper way to use a custom table? [closed]
- How to retrieve the value stored in a multi-dimensional array and SUM the entries?
- Adding a Table to the wordpress database
- Integrate WordPress into existing website
- How can I use get_bloginfo(‘admin_email’) in a custom PHP file?
- how can I change the background color of all posts on my server?
- Turn off redirect to canonical domain (or host website on any hostname)
- CSS to remove “comments count” icon from main page [closed]
- What’s wrong with Customizing new user notification email by add_filter?
- Automatically Update Woocommerce Prices [closed]
- Multiple Tinymce/wp_editor in WordPress >4.8
- CPT Loop with ACF and passing ID between Loops
- Showcase elementor templates
- Add clickable arrows to parent menu items with children elements e.g. with
- No shipping method has been selected [closed]
- How can I setup up an a pre-populated pdf based on what was entered? [closed]
- Organizing the position of widgetized areas in the backend
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- Why the css in twenteenfourteen-child theme take no effect?
- Get wordpress taxonomy slug name(s) to use as div class
- Why does my Posts page only show a single post when using Thematic?
- add custom content to appearance/widgets screen
- css media query question [closed]
- How to create a page /1 using ?
- Open “Visit site” in a new window?
- Pagination with custom field
- What’s the right way to share data between widgets?
- Where to upload my new custom ShortCode in Separate .php file?
- wp_insert_post custom taxonomy multiple Category not added
- Get custom text if in Category
- Conditional Logic on CF7 dropdown options
- Change admin_title of a plugin using code snippet/functions
- Can’t upload format files on media library
- Adding a custom field to a slug
- How to show Term ID beside Name Category with wp_dropdown_categories()
- How to create custom backend admin menu in different languages?
- WordPress Performance and bulk edits
- Delete page titles
- Send email notification when post type product is publish from pending status
- How to add custom Author Info Box to blog posts “only” and NOT custom post templates
- Bio comes up when the visitor clicks on a picture
- Accountless password generation
- Creating a Treeview Listing of a Directory
- WooCommerce – Adding custom HTML to specific product pages
- How to create new page can get custom field other post in wordpress
- insert autofocus in a custom taxonomy form
- display my pages html
- customize footer widgets area
- Accessing + retrieving custom database in WordPress
- updated permalink structure on localhost does not work
- adding new html css to wordpress section from codepen [closed]
- how do i add logo in my site
- Show total sales for each products on search results page Woocommerce
- Permalink Listing WordPress