this is in template-parts/content.php which may be different based on your theme or version of wordpress. you can locate the category id in wordpress by going into categories and then clicking ..
if you ever need to search for a file in a zip file this is how to do it (in windows). Also you will need to install 7zip Open a command prompt CTRL+R and type cmd cd C:\Program Files\7-Zip 7z l c..
Fix for Fatal error: Uncaught Error: Call to undefined function file_get_dom() simplehtmldom simple_html_dom
This error is caused due to a function name change in the simple_html_dom.php library if you are using an older one and upgrading to the never version, you can see it in the change log here: https://s..
Apparently this error is caused by not closing the database after using it. Warning: SQLite3::query(): Unable to execute statement: database is locked. You can close the database using the fol..
this can change a lower case or any case into upper case using the str to upper php function Example
this is an example using: get_the_date: this one gets the post date the_excerpt: which gets the .. excerpt or summary text from the post and get_the_post_thumbnail_url which gets the image from th..
gets the page content and displays it on a template, this must use the post loop as shown in the code.
here is a jquery document ready that also loads the foundation js library. im not sure if the document foundation needs to be loaded in the document ready, but this way seems to work.
this function will add a click event to the target if the window size is greater than the target_width
This will check if the google checkbox is checked and then enable or disable the form button depending on the outcome. This is just a basic version of this check, you should also check that the captu..
this is how i get a live reloading dev environment up and running on my windows pc's using node , npm and browsersync.
My tests using the Spread Operator rather than the apply function. In the 1st function show_max_array i use the apply operator to convert the array into comma seperated values. In the show_max_array..
If you don't know how many parameters you will need in your function you can use the rest operator to pass them in. ...
in this exercise i will take a function variable and write it in one line using the arrow function
this function uses the parseInt function to return a proper integer or an error code if it can't. So this demo should return NaN for the Not an Int (x1235) and The int for the 00001235. I think that N..
this will split the string into an array based on the spaces inbetween words. you can split it based on any character, for example if you had words in csv comma format you could use the second example..
this is a template that i use while testing flat html files, if you add it to a server it will live reload. this does seem to cause issues depending on the site that is is used on, like reloading all ..
generate a random whole number function with test buttons
using xcopy and a loop i found this is a good way to make sure that changes in one file make their way across to another location using a windows batch file. this one loops every 5 seconds, i think yo..
get the average of a array of numbers
this is good if you want to change a form checkbox with the default and show a fancy tick or something else, this will still check the checkbox so will work normally as the form element
$dot_location = strpos($my_string,".");
basic usage for the str_replace php function str_replace ( mixed $search , mixed $replace , mixed $subject)
just in case you need to create a CURRENT_TIMESTAMP using php, this formats the current date into the following.
ok so lets say we have a string like this: Hi there im a string. I am also part of the same string. And we want to shorten the above string into just: Hi there im a string. This is what i wo..
this function will show you the percentage difference between two numbers
/ - opening delimiter (necessary for regular expressions, can be any character that doesn't appear in the regular expression \( - Match an opening parenthesis [^)]+ - Match 1 or more character that..
Lets say we have a string like this hi there im a string (not really a string). and we want to remove this bit (not really a string) We can do this using the following regex (preg_replace) $strin..
I ususally use this one if i am linking to files in the server document root folder rather than specifying ../directory/include.file.php i will use something like this: $document_root = $_..
if you are using page templates in wordpress and need to show content from wordpress this is the easiest method. This only works for wordpress "pages" not blog "posts". For showing blog posts you will..
this usually happens if the permissions on the wordpress wp-content folder are not correct or writable. check the permissions are correct: (this is for apache, the user names might be different che..
Useful if you need to get PHP to return parts of the date. The date today in number format $date_today = date("d"); e.g: 21 Todays month name $month_name = date("F"); e.g: July ..
this will download the url and extract its meta tags returning a json encoded string, with json headers. If the url is accessable. <?php header('Content-Type: application/json'); if(!isset($..
this quick function will check if the page is home or not good if you want something on the other pages and something just on the home page in the header or that kind of thing. i have tested this i..
Using advanced custom fields, if you know what the shortcode is and what you want to replace it with you can do so with the following. $site_url = get_site_url(); $field = get_field('template_ht..
do a case-sensitive search for a string within another string strpos mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) usage find the 1st location of a string position within a..
this is surprisingly hard to find code that lists all blog posts in a template with the feature image that does not use an additional plugin. you shouldnt need a plugin to do this as its already built..
if you are looking to show the page content in a template you can find that here. This will show all posts in the selected category <!-- // show the post content --> <?php $my_query ..
This usually goes in the theme functions file. This will load it after jquery if it requires it. wp_register_script('scriptname', get_template_directory_uri() . '/js/scripts.js', array('jquery'), ..
this one can be useful for fitting text into smaller places without it looking broken. text-overflow: ellipsis; this basically adds the 3 dots where the end of the text used to be... Also if you are ..