This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Replace 8 with your form ID | |
add_filter( 'gform_pre_render_8', 'populate_region_field' ); | |
add_filter( 'gform_pre_validation_8', 'populate_region_field' ); | |
add_filter( 'gform_pre_submission_filter_8', 'populate_region_field' ); | |
add_filter( 'gform_admin_pre_render_8', 'populate_region_field' ); | |
function populate_region_field( $form ) { | |
foreach ( $form['fields'] as &$field ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('init', 'custom_post_type_pagination_rewrite'); | |
function custom_post_type_pagination_rewrite() { | |
$archiveSlug = 'archive-slug'; // Replace with the archive page slug | |
$archiveID = 55; // Replace with the archive page ID | |
add_rewrite_rule( $archiveSlug . '/page/?([0-9]{1,})/?$', 'index.php?page_id=' . $archiveID . '&paged=$matches[1]', 'top'); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// REGISTER CUSTOM POST TYPE | |
add_action( 'init', 'custom_post_type', 0 ); | |
function custom_post_type() { | |
$labels = array( | |
'name' => 'Custom Post Types', | |
'singular_name' => 'Custom Post Type', | |
'menu_name' => 'Custom Post Types', | |
'name_admin_bar' => 'Custom Post Type', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'html_sitemap', 'html_sitemap' ); | |
function category_has_children( $term_id = 0, $taxonomy = 'category' ) { | |
$children = get_categories( array( | |
'child_of' => $term_id, | |
'taxonomy' => $taxonomy, | |
'hide_empty' => false, | |
'fields' => 'ids', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'toc', 'toc' ); | |
function toc( $atts ) { | |
$atts = shortcode_atts( | |
array( | |
'levelone' => 'h2', | |
'leveltwo' => '', | |
'levelthree' => '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example usage: [custom_page_block id="55"] | |
add_shortcode( 'custom_page_block', 'custom_page_block' ); | |
function custom_page_block( $atts ) { | |
// Attributes | |
$atts = shortcode_atts( | |
array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'personal_options', 'user_edit_ob_start' ); | |
add_action( 'show_user_profile', 'insert_nicename_input' ); | |
add_action( 'edit_user_profile', 'insert_nicename_input' ); | |
add_action( 'user_profile_update_errors', 'profile_update', 10, 3 ); | |
function user_edit_ob_start() { | |
ob_start(); | |
} |