Substring From start of string From end of string Get String Before & After Character/String If Present Remove First Word In A String Remove Last Word In A String Get String Before First Occurrence Of A String Get String After First Occurrence Of A String Neat way of getting just the string after the search string: Getting […]
All posts by
Using Strings-Searching Strings
Does String Contain String str_contains strpos() strpos ($haystack , $needle , $offset = 0 ) Returns False on no match or first occurrence index (from 0) on match Does string start with Does string end with
DELETE
Delete rows Delete based on DateTime
INSERT
Was INSERT sucessful? Get Auto ID Of New Record The insert_id() function returns the auto generated id used in the latest querywith a column having the AUTO_INCREMENT attribute.
INSERT or UPDATE
Alter Page
Use A Shortcode You can add a shortcode to the page and a function for it to add dynamic content, javascript, etc
Logout Link
The wordpress logout way requires you to redirect to their logout page. Nice way is to use a custom url, in this case pointing to /logout, and code (no need to create page)
Redirect to page
Before outputting page content Redirect based on the home URL Redirect based on the site URL If you’ve outputted some page content Using a META tag is the easiest way Redirect on “Page not found” Create a page called 404.php. Place this code in it:
Detect Page
Is the users page ####?
Strange Errors Checklist
Heredoc string ( $MyString = <<<_END ) terminating markers The terminating marker must be at the start of a line and also the only thing on the line – no comment or even whitespace after it!!!