Skip to content

Instantly share code, notes, and snippets.

Avatar

TarttWeb TarttWeb

View GitHub Profile
@TarttWeb
TarttWeb / add-gtag-wordpress-header
Last active December 1, 2022 18:29
Add GTAG to WordPress Header
View add-gtag-wordpress-header
// Add Google Analytics to <head>
function add_google_analytics_to_head() {
// Paste the whole google tracking tag (gtag.js) here.
}
add_action( 'wp_head', 'add_google_analytics_to_head' );
@TarttWeb
TarttWeb / add-reusable-blocks-wp-admin.php
Created April 5, 2022 18:13
Add Reusable blocks menu item to WordPress Admin area
View add-reusable-blocks-wp-admin.php
<?php
// Add Reusable blocks to WordPress Admin area
function add_reusable_blocks_admin_menu() {
add_menu_page( 'Reusable Blocks',
'Reusable Blocks',
'edit_posts',
'edit.php?post_type=wp_block',
'',
'dashicons-editor-table',
22
@TarttWeb
TarttWeb / basic-css-header-example.css
Last active April 5, 2022 17:47
Basic CSS Header Example
View basic-css-header-example.css
/* This is for the id */
#article-header {
background-color: #0000ff;
width: 100%;
padding: 20px;
}
/* This is for the class */
.article-title {
font-color: #ffffff;
font-size: 18px;
@TarttWeb
TarttWeb / basic-html-header-example.html
Created April 5, 2022 17:38
Basic HTML Header Example
View basic-html-header-example.html
<!doctype html>
<html>
<title>Page Title</title>
<body>
<div id="article-header">
<h1 class="article-title">Article Title</h1>
</div>
</body>
</html>
@TarttWeb
TarttWeb / header-css-example.css
Last active April 5, 2022 17:52
H1 Header CSS Example
View header-css-example.css
h1{
color: #0000ff;
font-size: 18px;
}
@TarttWeb
TarttWeb / html-id-class-example.html
Last active April 5, 2022 17:51
HTML ID & CLASS Example
View html-id-class-example.html
<!doctype>
<html>
<head>
<title>Example of Element id & class attributes</title>
<style>
#main-heading {
font-size: 35px;
color: blue;
}
.my-first-paragraph {
@TarttWeb
TarttWeb / basic-html-doc-example.html
Last active April 5, 2022 17:53
Basic HTML Document Example
View basic-html-doc-example.html
<!doctype html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Page Heading</h1>
<p>My first paragragh</p>
</body>
</html>
@TarttWeb
TarttWeb / load-custom-script.php
Created April 5, 2022 16:14
WordPress Load Custom JavaScript File Example
View load-custom-script.php
<?php
function load_custom_script(){
wp_register_script( 'custom-js', custom.js', false );
wp_enqueue_script( 'custom-js' );
}
add_action( 'wp_enqueue_scripts', 'load_custom_script' );
@TarttWeb
TarttWeb / wordpress-filter-example.php
Last active April 5, 2022 16:18
WordPress Filter Example
View wordpress-filter-example.php
<?php
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
@TarttWeb
TarttWeb / wordpress-action-example.php
Last active April 5, 2022 16:20
WordPress Action Example
View wordpress-action-example.php
<?php
function custom_copyright_notice() {
echo "Copyright © All Rights Reserved";
}
add_action('wp_footer','custom_copyright_notice');