Version: 1.9.8
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group | |
WP_ROOT=$1 # <-- wordpress root directory |
.clearfix { | |
*zoom: 1; | |
} | |
.clearfix:before, | |
.clearfix:after { | |
display: table; | |
line-height: 0; | |
content: ""; | |
} |
# ----------------------------------------------------------------- | |
# .gitignore | |
# Bare Minimum Git | |
# https://salferrarello.com/starter-gitignore-file/ | |
# ver 20221125 | |
# | |
# From the root of your project run | |
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore | |
# to download this file | |
# |
function my_remove_wp_seo_meta_box() { | |
remove_meta_box('wpseo_meta', YOUR_POST_TYPE_NAME_HERE, 'normal'); | |
} | |
add_action('add_meta_boxes', 'my_remove_wp_seo_meta_box', 100); |
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
This solution fixes the error caused by trying to run npm update npm -g
. Once you're finished, you also won't need to use sudo
to install npm modules globally.
<?php | |
/** | |
* Prevent top level permalink slugs that will cause conflicts. | |
* | |
* New rewrite slugs are introduced when CPTs or Custom Taxonomies are created. | |
* This code adds a check when Pages or Posts are created, that their Permalink | |
* does not conflict with one of the reserved top level slugs you define. | |
* | |
* In the case of a bad (i.e conflicting slug), WordPress appends a "-2" to | |
* the permalink. |
function debug_404_rewrite_dump( &$wp ) { | |
global $wp_rewrite; | |
echo '<h2>rewrite rules</h2>'; | |
echo var_export( $wp_rewrite->wp_rewrite_rules(), true ); | |
echo '<h2>permalink structure</h2>'; | |
echo var_export( $wp_rewrite->permalink_structure, true ); |
<?php | |
/** | |
* WPForms custom redirect | |
* | |
* @param string $url URL form will redirect to | |
* @param int $form_id Form ID | |
* @param array $fields Submitted form fields | |
* @return string | |
*/ | |
function wpf_custom_redirect( $url, $form_id, $fields ) { |