Skip to content

Instantly share code, notes, and snippets.

@kingdomcreation
kingdomcreation / wp-config.php
Created August 26, 2021 11:23
Custom configuration file
<?php
/**
* The custom configurations of WordPress.
* This file will be loaded instead of wp-config.php in the wordpress folder
* if placed in the parent folder. It allows you to leave all the original files
* from the source in the directory and relocate the wp-content directory.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
<?php
/*
* Enable custom login style
*/
add_action("login_head", "my_login_head");
/*
* Change login page style adding your custom css in $output
*/
@kingdomcreation
kingdomcreation / wordpress-blank-functions.php
Created April 18, 2019 13:37
Blank removes and disables multiple WordPress defaults
// Blank removes admin bar by defaults
function blank_admin_bar() {return false;}
add_filter( 'show_admin_bar' , 'blank_admin_bar');
// Blank disables the xml feeds
function blank_disable_feed() {wp_die( '' );}
add_action('do_feed', 'blank_disable_feed', 1);
add_action('do_feed_rdf', 'blank_disable_feed', 1);
add_action('do_feed_rss', 'blank_disable_feed', 1);
add_action('do_feed_rss2', 'blank_disable_feed', 1);
@kingdomcreation
kingdomcreation / wordpress-cli-blank.sh
Created April 18, 2019 13:25
Setup script for a blank theme
# Creates a new blank theme based on underscores
wp scaffold _s theme --activate --woocommerce
# Remove bundled themes
wp theme delete twentynineteen
wp theme delete twentyseventeen
wp theme delete twentysixteen
# Reset default sidebar
wp widget reset sidebar-1
@kingdomcreation
kingdomcreation / manifest.json
Created September 7, 2016 22:23
Android's app icons manifest.json example
{
"name": "App",
"icons": [
{
"src": "\/android-icon-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
<?php
echo apply_filters( 'the_content', $acf['section2_before']->post_content);
?>
<?php
$items = $acf['section2'];
for ($i=0; $i<sizeof($items); $i++) {
echo '<article id="'.$items[$i]->ID.'" class="col-xs-4">';
echo apply_filters( 'the_content', $items[$i]->post_content);
<?php
$primary =array(
'container' => '',
'theme_location' => 'primary',
'menu_class' => 'nav navbar-nav',
'walker' => new wp_bootstrap_navwalker(),
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback'
);
wp_nav_menu($primary);
<?php
if ( ! function_exists( 'theme_setup' ) ) :
function theme_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'theme' ),
'networks' => esc_html__( 'Social Icons', 'theme' ),
) );
}
<?php
/* Template Name: Landing Page */
define('BASE_URL',get_stylesheet_directory_uri());
define('POST_ID',$wp_query->queried_object->ID);
// ACF Fields
$acf = get_fields(POST_ID);
@kingdomcreation
kingdomcreation / start-visuallyhidden.html
Created December 31, 2015 05:49
Visually hide elements during page load to prevent flicker
<!-- Add to head before any loading occurs -->
<style id="loading" type="text/css">
.start-visuallyhidden, .svh {
border: 0;
clip: rect(0,0,0,0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;