snippet from https://www.pradipdebnath.com/2019/08/17/how-to-add-page-template-from-plugin-in-wordpress/
This will work when the parent has a width of 60% and the “floating global page width” is 1400px
A PEN BY Maria https://codepen.io/Shorina/pen/VbepBe
PixelsEMsPercentPoints 6px0.375em37.5%5pt 7px0.438em43.8%5pt 8px0.500em50.0%6pt 9px0.563em56.3%7pt 10px0.625em62.5%8pt 11px0.688em68.8%8pt 12px0.750em75.0%9pt 13px0.813em81.3%10pt 14px0.875em87.5%11pt 15px0.938em93.8%11pt 16px1.000em100.0%12pt 17px1.063em106.3%13pt 18px1.125em112.5%14pt 19px1.188em118.8%14pt 20px1.250em125.0%15pt 21px1.313em131.3%16pt 22px1.375em137.5%17pt 23px1.438em143.8%17pt 24px1.500em150.0%18pt
Filter Instructions
On wp engine, if you want to strip all URL requests of just the file name. LIKE: http://yoursite.com/resources.aspxTO: http://yoursite.com/resourcesThen use this Source* ^/(.*)/?\.aspx Destination * http://www.yoursite.com/$1
Remember to change the “theme folder” name.
Don’t forget to
Just set this for a daily event. Then re activate your theme Check it with this
For a page template just so you can see what’s going on Defer all scripts For the functions file. Dequeue ALL styles and ‘defer’ all scripts Edited If you are really desperate … grab the entire header output and modify it You can try this … put this is functions You can try this … […]
Normally used in sidebar
# WEEK Header set Cache-Control “max-age=604800, public”
This opens WordPress’ Media Library in the backend
function to_datetime($string) { $timestamp = strtotime($string); $datetime = date(“Y-m-d H:i:s”, $timestamp); return $datetime; }
Tom Bowers posted this on Stack Overflow.
Protect WordPress config file with a $_session var
Checks if the element is in view and if it is it fires
Change URL without refresh
Integrate font awesome Don’t forget to add the folder/file “css/font-awesome.css” and then of course the “fonts/ALLTHEFONTS” in the theme directory
Categories To Apply It Use “get_posts” Tags
If the element exists
Set this once in the functions file Then paste this permanently in the general functions file Then call it like this
transition: all .2s ease;
Scrape External Page For Tags With Certain Classes
Add to “post page options” slider_image_urls slider_image_links In Post Page Meta In backend.css and add “drag_n_drop.png to image file In backend_scripts Add em_pic_handler.php to funtions file and folder Add slick.min.js and call it in the header Add this to theme Add this to frontend call
Set up mobile menu HTML CSS JS
Use this a lot For custom post types
With this you can add a message that will remind password re-seters to check their spam folder if they don’t get the email
Check For Flex Box Support
Page Unload Warning
This one is for pages This one is for Users
This sets featured image programmatically With AJAX… all you need is the image URL to be sent to your ajax file. It then copies the image to the uploads folder and sets it as the “featured image” for the post ID you ALSO sent up with the AJAX call.
To implode or explode
Just Selects all rows Update Table OR…… Insert Row
Thanks to Kyle Barber. This is his snippet of code
Add this to the functions file to get a nice Accordion function Then add to js Then add to css
Formstack example using curl.
display: flex; flex-flow: row wrap; justify-content: space-between;
Use this to create a custom post type It includes the custom post taxonomy and supports (like thumbnail, categories, and excerpt)
A non .htaccess way to force a SSL on a single page in WordPress
Use this to turn any classes or ids off easily declared in the tag itself.
Setup for a uber menu Item. This requires of course my “display_sidebar” shortcode.
This will call a widget sidebar by shortcode
This in the form This in processor
Use as a first validation layer Step 1: add the form ID to the submit button attribute Step 2: Make sure each input field PARENT has a ID. That way the “error class will be added to the parent wrapper. Step 3: Make sure each input field has a “data-error-message” attribute. This will be pasted […]
Post from submissions with PHP Nice little snip I got from here
When you need a list of feed pages You know…at the bottom of a feed page, the list of how many other older posts they can view if they want
Create a back door in WordPress that will make a admin user Use this if you are afraid the client will delete your admin user and lock you out of the site.
This function checks a link or string and returns what social site it belongs to It could be refined of course but it works for now
Need to create pages based on a site map?
Add a start and end time meta field for posts Just paste this entire snipit into your functions file and you should be good to go Now spit it out!!! spit it out!!! spit it out!!!
paste this code in functions.php to customize the log in screen Then make a style sheet called style-login.css and put in in your theme directory
Basic bare bones front end registration form This is the function used to validate registration submissions. Filters the spammy bots This is the custom registration form processor Here is the log in redirect for non admin members This adds and saves extra user meta in the backend Basic front end profile edit form This saves […]
Use this to create shortcodes of custom content It’s great for SVGs that you don’t want to dump all that code text onto your code layout. Keeps things clean.
Find “something + wildcard + something” The magic is in the .* and don’t forget the U at the end to control the greedy.
Redirect from your .htaccess file Redirect domain but keep colder calls
This code will add a SVG area to your back-end Then you can call the SVG with a shortcode. That way your SVG code doesn’t take over your layout. Just paste this entire snip into your function.php file.
This magic function will sort multi dimensional arrays…. Yay!
Fine piece by BotCrawl You can find their article here.
If you want your page to auto scroll down to the end of the menu on phones A little snippet for WordPress. Paste this in the header.php Then place this IDed div below your menu.
This processes pics that are uploaded at post
This is good for adding a widget window to your theme Paste this into your function.php file. Paste this into your theme template file.
This little function will update a named BuddyPress field
This will give you the value of a X profile field
This will toggle something every other day.
Use this to call a different style-sheet for phone. I added the admin function for development.
This little script will handle all your toggle needs. Place class “on_off” and then set your data toggle class. This will handle on and off commands for a specific non family class or ID. This will also handle toggling a child of the clicked element. It will also work for a sibling of the clicked […]
Bare bones basic bbPress Topic loop You will probably never need to spit out ALL the replies so I added the arguments above it. You will probably never use anything more stripped down than this when spitting out replies.
Bare bones basic bbPress Topic loop This loop will spit out ALL the topics on your WordPress site. You probably don’t want all the topics. You probably just want the topics of a certain Forum. Well…if you have the ID of that forum do this.
This is your most basic bbPress forum loop Use this in any template where you want the forum title and the forum content to spit out onto the page. I have intentionally left it very basic to start. It just spits out the forum title and the forum content.
Gets a single post by ID…very useful
Wrap this around anything that you want only logged in people to see.
Just your every day average html form
Use this to process anything before all the other filters and fuctions get their grubby little paws on it This can be used to call a custom template when some condition is met. This can be used to catch $_POST data and do something with it. It can be used to redirect people if some […]
Paste this into your functions file and never worry about another comment ever being added to your WordPress site.
Adds a basic metabox on your post screen This first snippet just declares the box and where it should appear This second snippet puts the fields in the box This last part is the “catcher” of the input from your added box. It basically saves what you enter in the meta box.
Custom Options For Your WordPress Theme Every WordPress developer that does custom themeing runs into the times when you have to have a spot to enter some kind of variable text…but you don’t want to call a single page or post just to get this little section of data. It’s tempting just to put it […]
Custom WordPress Query that should have everything you need Has all the Query arguments. Just delete the ones you don’t need. Has everything set up but kept the formatting to a minimum. I will probably copy and paste this string of code a million times by the end of my career.
The most basic WordPress loop
Gets the value of the data attribute in a html tag If your html tag looks like this: I like to use these in click functions This will alert “some cool data”
The Isset used for form submissions I always need this snippet. I like to copy paste it so I know it’s not wrong. You got to have it for any form you develop.
Basic jQuery document ready snippet First part is the jQuery library call. Then the doc ready code below it. I realize this is super basic but I copy paste everything. I don’t trust my memory and certainly don’t trust my spelling so I live by the paste. I threw in a click function just because […]
Jquery JavaScript responsive code command If you are looking for the code to only fire when someone is viewing the page from a phone, then this simple if command is what you need.
Jquery Code to jump to a element ID on the page This is a very useful snippet. Give it a click class at the “.nav_button” Then give it a element ID at “#main_slide”
How to hide anything in your WordPress template from non admins This code comes in handy when you want to put content in your custom WordPress template that you only want logged in admins to see. It’s also good for building live site pages that clients absolutely don’t want available to the general public
For anyone who comes across the need for a post feed or a page feed. I just wrote a small short-code plugin for a client that can make this easy. It’s a feed short-code. Just paste the short-code onto the page you want the feed to appear. You can edit the parameters to get the […]
Just the start Take it to the bodyyyyyyyyyyyy………..take it to the HEAD