Author: super_admin_v3x

Layout (Menu Items, General)

If you wish to alter the display of the WPPizza menu items – alongside many other layout elements – from the installed default, use any of the options below Goto “WPPizza ->Layout” Goto “Style” on that page and choose from one of the style options 

Gateway – Stripe

Filters/Codesnippets WPPizza -> Gateways -> Stripe Codesnippet(s) to modify “Stripe” gateway options – namely test/live api keys in this example – depending on the user selection of a custom added dropdown formfield, in this case allowing for different stripe accounts to be targeted depending on 

Removing version numbers

The below isn’t really about WPPizza in particular but WordPress in general, and I feel the need to state why removing version numbers from WordPress javascript or css files – either by some custom filtering, using some plugin or even having this kind of thing in-built into your theme – is just a very bad idea in my opinion.

 
 

The 2 main arguments are usually as follows:

 

Removing version numbers makes my site more secure as nobody knows what version of WP is running

  • Sorry, but this simply isn’t the case. Maybe it was once upon a time in ancient times, but with the tools available these days it really is childsplay to find out what version of WP you have running, regardless of whether or not you have removed the version number. Furthermore, security by obscurity never was and never will be the right approach to securing anything.

 
 

It will allow browsers to cache the javascript and css resources

  • First of all – though that may not be true for *all* browsers on the planet – browsers these days are clever enough to serve cached resources if the full source url (incl any parameters appended) has not changed. Even more so, if the server has been set up to explicitly set an expiration time for those resources via .htaccess or via other means.

    More importantly though, YOU DO NOT ACTUALLY WANT js/css files to be served from cache when they have changed.

 
 

Consider the following:

  • – “User A” goes to site the first time and does his/her thing. While he/she is there the js/css files are being cached in the users browser and served from cache while the user is navigating the site. That’s all good.
  • – At some point, after the visit of “User A” previously, the administrator of the site, being on top of things, saw there are updates for plugins/themes available and therefore updated the plugins/themes to the latest version to know the site is running the latest and greatest.
  • – A few hours later, “User A” returns to the site to do some more research or buying more products or whatever the site offers.
  • – However, version numbers were removed from the css/js files, so the browser of “User A” says: “Cool, I just use the css/js from my cache as it’s still the same file”, except, it isn’t the same file anymore as the plugin was updated and there’s a good chance the js/css files were too, so the cached js files will not work with the functionality of the updated plugin and it all falls over and things break. If the version number would have still been appended, the browser would have known it’s a different/changed file and would have downloaded – and subsequently cached – that new file…..

 
 

You might even break styles/scripts entirely (depending on how version numbers are removed)

  • There are various jquery-ui and other components that are inbuilt into WP and you can load as required.
  • So you could do this, to load the ‘jquery-ui-spinner’ $ui = $wp_scripts->query('jquery-ui-spinner');
  • If I want to use the associated ‘smoothness’ theme, i’d additionally want to load the following css //ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css
  • The problem is, that, to get the right associated version in practical terms – in this case 1.11.4 – you would write something like the following//ajax.googleapis.com/ajax/libs/jqueryui/".$ui->ver."/themes/smoothness/jquery-ui.min.css
  • However, as version numbers were removed, that css url will now look like this //ajax.googleapis.com/ajax/libs/jqueryui//themes/smoothness/jquery-ui.min.css which will produce nothing but a 404 and an entire stylesheet is missing from your site

 
 

Of course, I do not claim to be the ultimate reference regarding the above and there may well be ways to remove version numbers more selectively or other ways to avoid the above scenarios.
The above is only a summary as to what I have seen being done countless times and wanted to share this here to make people think twice about doing this or if they choose to do so to be aware of the possible consequences.

Thanks for reading…..

Checkout Formfields

Modify the customer form fields available on the checkout page A few examples as to how you can show/hide/add/modify input formfields available on the checkout page Simple show/hide formfields using css selectors If you wish to simply show hide some formfields when an order is 

Confirm | Reject | Notify

Filters available using WPPizza – Confirm | Reject | Notify wppizza_crn_sms_branding Allow “Branding”: Send some arbitrary text instead of sending a phonenumber as “Sender ID”. Be aware that this will not work if you are using 2-way or 3-way SMS settings (as the recipient would 

Email Subject Line

Change the default subject line used in emails

wppizza_filter_email_subject

/*** 
	email subject lines are made up of 3 parts 
	filter each part as required based on your preferences

****/
add_filter('wppizza_filter_email_subject', 'myprefix_filter_email_subject', 10, 2);
function myprefix_filter_email_subject($subject, $order_formatted){

	/*
		defaults

		//dynamic depending on settings in wppizza order form , but typically its the site name plus perhaps some personal info */
		$subject['prefix'] 	= '[--------- conditional/dynamic text ---------------]' ;
	
		//from wppizza->localization
		$subject['main'] 	= $order_formatted['localization']['your_order'];
	
		//date/time according to wordpress date/time settings */	
		$subject['suffix'] 	= date_i18n($order_formatted['date_format']['date'], WPPIZZA_WP_TIME)." ".date_i18n($order_formatted['date_format']['time'], WPPIZZA_WP_TIME)."";

		//This typically produces something like
		"My Shop Your Order March 25, 2020 6:31 pm" 
		where:
		$subject['prefix'] = 'My Shop';
		$subject['main']= 'Your Order';
		$subject['suffix']= 'March 25, 2020 6:31 pm';
	*/

	// example: if you want to not add the date/time at the end
	$subject['suffix'] = '';	
	//or simply
	unset($subject['suffix']);	

	// example: change the typically main "My Order"
	$subject['main'] 	= 'whatever it is you want';

	// example: add something after it all
	$subject['some_additional_key'] 	= 'something added to the end of the subject line;

	/*
		for conditionals depending on order values, 
		you can use the 2nd "$order_formatted" parameter
	*/

return $subject;
}

Delivery By Post/Zipcode

Shortcodes If you wish to display the delivery by post/zip-code selection in a different location [wppizza_dbp] If using google maps option: displaying the *dashboard map widget* showing your orders elsewhere: Shortcode: [wppizza_dbp_map] Available attributes: orders – orders to display according to status set. default: “new,delivered”. 

Pdf Invoices

CSS Declaration Examples and Filters available using WPPizza – Pdf Invoices Using your own font (this must be a truetype font – see also “Know Issues” below) To use your own font, follow the guide below: Go to “WPPizza -> Settings-> PDF Invoices” Make sure 

Enable Debug

in your wp-config.php you will find a line that reads (most likely) like this:
define('WP_DEBUG', false);

REPLACE this with (or if it does not exist simply add the below)


define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);/*this should NEVER be true for production sites*/

Note: this MUST be before /* That's all, stop editing! Happy blogging. */

Which will generate a file “wp-content/debug.log” if and when any errors are encountered.
Check this file for errors if you need to find out where things might go wrong

View the Help Screen

Note that in many cases a lot more information/help is available in the help screens of the plugin

View your browsers console (Typically by clicking Ctrl+Shift+I)

If you see some “500 Internal server errors” in there, check your server error log. In many cases these are caused by uploading a plugin with the wrong permissions – especially if you add plugins by ftp instead of using the standard wordpress plugin installer. You should also aim to fix any other javascript errors you may have, although some might be more problematic than others

General Troubleshooting

If you have issues with WPPizza – or WordPress in general for that matter – I would highly recommend the following resource to narrow down where your issues might be

As I could not say this any better, forgive me for simply providing the link above. I would however especially recommend the “Troubleshooting Plugins” section about 2 thirds down on that page.

Of course, if you have followed the recommendations on that page without being able to solve your problem and still have issues with WPPizza, please get in touch via the common channels (forum, contact form, emails)

Headers already sent …

if you get something like: Warning: session_start(): Cannot start session when headers already sent in [site-path]/wp-content/plugins/wppizza[xyz]/[some-file] on line [some-line] or Warning: cannot modify header information – headers already sent by [site-path]/[some-dicetory]/[some-file] on line [some-line] The problem is that either: – php notices/warnings/errors etc are output