• I created a new file mytemplate.php in folder virtue/templates. Then I create a new Page and select my new template.

    The problem is : header,sidebar,footer, background image still include into my template even when I don’t call any css, html…

    So how to create a blank template (because I create a payment system that’s just receive a value, this system doesn’t accept any html,css).

    Please help me !

Viewing 9 replies - 1 through 9 (of 9 total)
  • What are the contents of mytemplate.php? If you’re calling get_header(), get_footer(), and get_sidebar(), remove those lines. Are you using body_class() in your page template?

    Thread Starter stupiddog

    (@stupiddog)

    I don’t call get_header() , get_footer() and get_sidebar() , but it still appear. I don’t understand why ?!

    My file is contain some codes about my payment gateway, not include anything else (html,css,div, or get_footer….)

    what is the exact full code of your mytemplate.php?

    Can you post the contents of mytemplate.php to Pastebin and post a link to it here?

    Thread Starter stupiddog

    (@stupiddog)

    This is my full code of file mytemplate.php

    <?php
    ini_set("display_errors", 0);
    /**
     * Template Name: My Order Result
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    //this code use both GET and POST method
    
    $mTransactionID = $_REQUEST['mTransactionID'];
    $bankCode = $_REQUEST['bankCode'];
    $transactionStatus = $_REQUEST['transactionStatus'];
    $description = $_REQUEST['description'];
    $ts = $_REQUEST['ts'];
    $checksum = $_REQUEST['checksum'];
    
    global $woo_options;
    global $woocommerce;
    require_once(WP_PLUGIN_DIR . '/classes/common.class.php');
    require_once(WP_PLUGIN_DIR . '/classes/rest.client.class.php');
    
    include_once(WP_PLUGIN_DIR . '/class-wc-gateway-pay.php');
    $gatemay_pay=new WC_Gateway_Paycc();
    
    $sMySecretkey = trim($gatemay_pay->settings['working_key']);//key use to hash checksum that will be provided by Pay
    $sRawMyCheckSum = $mTransactionID.$bankCode.$transactionStatus.$ts.$sMySecretkey;
    $sMyCheckSum = sha1($sRawMyCheckSum);
    
    if($sMyCheckSum != $checksum)
    {
    	 response($mTransactionID, '-1', $sMySecretkey);
    }
    
    $iCurrentTS = time();
    $iTotalSecond = $iCurrentTS - $ts;
    
    $iLimitSecond = 300;//5 min = 5*60 = 300
    
    $status_num=-1;
    $oder_code=0;
    $order_id = $wpdb->get_col($wpdb->prepare("SELECT order_id FROM <code>&quot;.$wpdb->prefix.&quot;order_pay</code> WHERE merchant_transactionID = %s ", $mTransactionID));
    $old_status = $wpdb->get_col($wpdb->prepare("SELECT status FROM <code>&quot;.$wpdb->prefix.&quot;order_pay</code> WHERE merchant_transactionID = %s ", $mTransactionID));
    
    if(is_array($order_id) && isset($order_id[0]) && $order_id[0]>0)
    	$oder_code=$order_id[0];
    
    if(is_array($old_status) && isset($old_status[0]) && $old_status[0]>0)
    	$status_num=$old_status[0];	
    
    $processResult = process($mTransactionID, $bankCode, $transactionStatus,$status_num,$oder_code,$wpdb);
    response($mTransactionID, $processResult, $sMySecretkey);
    
    /*===============================Function region=======================================*/
    function process($mTransactionID, $bankCode, $transactionStatus,$status_num,$oder_code,$wpdb)
    {
    	try
    	{
    		if($oder_code>0){
    			 $order = new WC_Order($oder_code);
    			//do you update order status process
    			if($status_num==1){
    				return 2;
    			}
    			if($transactionStatus==1){
    				$order->payment_complete();
    				$order -> add_order_note('Success !');
    				$order->update_status('Completed','');
    
    			}
    			else{
    				if($transactionStatus!=$status_num){
    					$order -> add_order_note('Failed !');
    
    				}
    			}
    			if($transactionStatus!=$status_num){
    				$wpdb->query("update <code>&quot;.$wpdb->prefix.&quot;order_pay</code> set <code>status</code>=".$transactionStatus." where <code>order_id</code>= ".(int)$oder_code);
    			}
    			return 1;//if process successfully
    		}
    			return -3;
    	}
    	catch(Exception $_e)
    	{
    		return -3;
    	}
    }
    function response($mTransactionID, $returnCode, $key)
    {
    	$ts = time();
    	$sRawMyCheckSum = $mTransactionID.$returnCode.$ts.$key;
    	$checksum = sha1($sRawMyCheckSum);
    	$aData = array(
    		'mTransactionID' => $mTransactionID,
    		'returnCode' => $returnCode,
    		'ts' => time(),
    		'checksum' => $checksum
    	);
    	echo json_encode($aData);
    	exit;
    }
    /*===============================End Function region=======================================*/
    ?>
    Thread Starter stupiddog

    (@stupiddog)

    My file contains just php code. I used this file in other theme, and it returned just a value (exact what I want). But in Virtue theme, header, sidebar… include (-_-?)

    Hey,
    This theme uses a wrapper function. It was based off roots: https://github.com/roots/roots

    So if you want to have a template with no header and footer then you need to create a special base-custom.php file.

    Kadence Themes

    Thread Starter stupiddog

    (@stupiddog)

    Hi Kadence Themes,

    I saw a file named ‘base.php’ in virtue’s folder. Then I created a file ‘base-custom.php’ with blank content. But how can I apply ‘base-custom.php’ into ‘mytemplate.php’.

    I have no idea. Could you teach me how to do that ?

    So how it works is the “custom” needs to be your page template name.

    So if you page template is really mytemplate.php the the base file needs to be :

    base-mytemplate.php and the theme will load it. But to be clear you have to have at least this in your base file or it won’t load your template file:

    <?php include kadence_template_path(); ?>

    Kadence Themes

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to create a blank template page ?’ is closed to new replies.