My plugin main file(Plugin.php)
The display page which I have made is inside this plugin only named as shopdetail.php and in that i have included
<?php
/*
Plugin Name: Coupon
Version: 1.0.0
Author: Akash Rai
Description: This plugin is for Coupon Management
*/
session_start();
ob_start();
include_once dirname(__FILE__) . '/includes/coupon_shortcodes.php';
function coupon_plugin()
{
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
}
$url = $_SERVER['REQUEST_URI'];
$product = substr($url,19);
if($url == "/preview/cash-back/$product" && $url != "/preview/cash-back/")
{
load_template( dirname( __FILE__ ) . 'includestemplatesshopdetail.php');
exit();
}
register_activation_hook( __FILE__, 'coupon_plugin' );
When I run the page it says:-
Fatal error: Call to a member function get() on null in C:xampphtdocspreviewwp-includesquery.php on line 28
I have created a custom plugin and in that plugin I have created a custom php page in which I am showing my description coming from database, but the problem is when I use get_header(); function then it does not display header of the main theme which I have implemented in project. Can anyone help me with it, I am little bit newbei
At the start of your plugin code try adding
If it still does the same error, underneath it add
If that is returning as null, then for some reason your plugin isn’t accessing wp_query, which is what is needed for get() I believe.