Skip to content

Instantly share code, notes, and snippets.

@WPCred1
WPCred1 / create-custom-shortcode.php
Created November 10, 2022 06:31
Example for creating shortcode
<?php
function download_link(){
return 'Get Best Variation Swatches for WooCommerce <a rel="nofollow" href="https://getwooplugins.com/plugins/woocommerce-variation-swatches/">Download Now!</a>';
}
add_shortcode('download', 'download_link');
?>
include('create-custom-shortcode.php');
@WPCred1
WPCred1 / additional-css
Created December 2, 2022 06:17
Code for Font Size Changing
p {
font-size: 22px;
}
@WPCred1
WPCred1 / gist:0e37cff5a251cfa68d07d338d2d2f5f5
Created December 4, 2022 08:48
Custom post-type function
// Custom post-type function
function create_posttype() {
register_post_type( 'movies',
// CPT Options
array(
@WPCred1
WPCred1 / gist:f7c73a06b84fc556b4c3cb96dfcb3abb
Created December 4, 2022 08:53
Creating a function to create our CPT
/*
* Creating a function to create our CPT
*/
function custom_post_type() {
// Set UI labels for Custom Post Type
@WPCred1
WPCred1 / functions.php
Created December 13, 2022 10:58
Adding Admin Notice
/**
*Adding the Admin Notice
*/function wpb_admin_notice_warn() {
echo '<div class="notice notice-warning is-dismissible">
<p>Remember to add internal links to recently published posts!</p>
</div>';
}
add_action( 'admin_notices', 'wpb_admin_notice_warn' );
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
body.postid-563 {
background-image: url("https://images.unsplash.com/photo-1661956601349-f61c959a8fd4?ixlib=rb-4.0.3&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2071&q=80");
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
@WPCred1
WPCred1 / functions.php
Created December 15, 2022 06:23
Add Custom Background
$defaults = array(
'default-color' => '',
'default-image' => '',
'default-repeat' => '',
'default-position-x' => '',
'default-position-y' => '',
'default-size' => '',
'default-attachment' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
@WPCred1
WPCred1 / wp-config.php
Created December 20, 2022 10:29
Post Revision Limit
/** Post Revision Limit*/
define('WP_POST_REVISIONS', 3);