Skip to content

Instantly share code, notes, and snippets.

@aaronsummers
aaronsummers / Contact form 7 form builder shortcodes
Last active December 18, 2023 19:45
Contact form 7 all fields and country dropdown
[text text class:classname class:otherclassname placeholder "placeholder"]
[email* email placeholder "Email Address"]
[url* url placeholder "http://..."]
[tel* tel placeholder "Phone no."]
[range* number-slider min:0 max:100 placeholder "Ammount"]
[number* number-spinbox min:0 max:100 placeholder "Ammount"]
@aaronsummers
aaronsummers / GIT housekeeping .md
Last active November 20, 2023 08:28
GIT housekeeping

Delete and update the ignored files in your local repository.

git rm -r --cached . && git add . && git commit -am "Remove ignored files"

Remove branches not on the remote.

  1. Switch to the master branch
  2. Run this command:
@aaronsummers
aaronsummers / array_chunk_post_loop.php
Last active July 13, 2023 01:13
Splitting post loop with array chunk, WordPress.
<?php
$args = array(
'post_type' => array('post'),
'posts_per_page' => 16
);
?>
<?php
/**
* https://developer.wordpress.org/reference/functions/get_posts/
* https://codex.wordpress.org/Template_Tags/get_posts
@aaronsummers
aaronsummers / howto.md
Created July 12, 2023 11:49
Add stubs to VS Code and DEVSENSE PHP extension

Install the stubs for ACF pro and WordPress using composer

ACF PRO stubs also installed other dependencies like WP stubs.

composer require php-stubs/acf-pro-stubs

If you're not installing the ACF stubs, add the WP stubs using the below command:

@aaronsummers
aaronsummers / nth-child.scss
Last active March 2, 2023 11:58
Conditional CSS widths using nth-child
// https://grack.com/blog/2015/01/09/abusing-css3-selectors/
// https://grack.com/assets/2015/01/nth-child/image-count.html
/* One */
img:only-child {
max-width: 100%;
}
/* Two */
@aaronsummers
aaronsummers / terminal.sh
Created December 7, 2022 10:26
Mac - Copy file contents to clipboard
pbcopy < ~/.ssh/id_rsa.pub
@aaronsummers
aaronsummers / custom-post-type.php
Created December 5, 2022 08:23
Using custom taxonomy as custom post type URL base
<?php
add_action( 'init', 'my_custom_post_types_init', 0 );
function my_custom_post_types_init()
{
/**
* Register the post types
*/
$my_post_types = array(
'property' => array(
'post_type_name_singular' => 'Property',
@aaronsummers
aaronsummers / part1.md
Last active November 30, 2022 06:21
Ajax filter for WordPress posts

Ajax post filter for WordPress

Part 1

  • First create a post grid ( 3 Column )
  • Add our CSS
    • Post grid
  • Filter
@aaronsummers
aaronsummers / TinyMCE.md
Created November 1, 2022 10:54
Editing Tiny MCE settings in WordPress

The documentation list all defaults and possibilities.

  • inline – Name of the inline element to produce, for example “span”. The current text selection will be wrapped in this inline element.
  • block – Name of the block element to produce, for example "h1". Existing block elements within the selection gets replaced with the new block element.
  • selector – CSS 3 selector pattern to find elements within the selection by. This can be used to apply classes to specific elements or complex things like odd rows in a table.
  • classes – Space separated list of classes to apply to the selected elements or the new inline/block element.
  • styles – Name/value object with CSS Style items to apply such as color etc.
  • attributes – Name/value object with attributes to apply to the selected elements or the new inline/block element.
  • exact – Disables the merge similar styles feature when used. This is needed for some CSS inheritance issues such as text-de
@aaronsummers
aaronsummers / remove-tag.md
Last active September 14, 2022 09:27
Remove tags from GIT Repository

Stackoverflow // Remove from the remote

git push --delete origin YOUR_TAG_NAME

Stackoverflow // Remove from local

git tag -d YOUR_TAG_NAME