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
function my_page_template_redirect() | |
{ | |
if ( is_category( 'uncategorized' ) ) { | |
$url = site_url( '/' ); | |
wp_safe_redirect( $url, 301 ); | |
exit(); | |
} | |
} | |
add_action( 'template_redirect', 'my_page_template_redirect' ); |
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
<a | |
href="<?php | |
echo esc_url( | |
add_query_arg( | |
array( | |
'cv'=>'type-1', | |
'user'=>wp_get_current_user()->ID | |
), | |
'/print-cv-chronological/' | |
) |
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
// Select all links with hashes | |
$('.menu-item-1385 a, .menu-item-1386 a, .menu-item-1387 a, .menu-item-1383 a') | |
.click( | |
function(event) { | |
// On-page links | |
// console.log(this); | |
if ( | |
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') |
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
$prev_location = get_post_meta($post->ID, '_cottages_custom_postal_code', true ); | |
$lat = get_post_meta($post->ID, '_cottages_custom_location_latitude', true ); | |
$lng = get_post_meta($post->ID, '_cottages_custom_location_longitude', true ); | |
if ( | |
( | |
$cottages_meta['_cottages_custom_postal_code'] != '' && | |
$prev_location != $cottages_meta['_cottages_custom_postal_code'] | |
) || |
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
function ascendia_scripts() { | |
wp_enqueue_style( 'ascendia-style', get_stylesheet_uri() ); | |
wp_enqueue_style( 'ascendia-style-non-sass', get_template_directory_uri() . '/style-non-sass.css', array(), '20171001', 'all' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'ascendia_scripts' ); |
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
// https://codex.wordpress.org/Plugin_API/Action_Reference/admin_footer | |
function my_admin_add_js() { | |
echo ' | |
<script type="text/javascript"> | |
var ajaxurl = "'.admin_url("admin-ajax.php").'"; | |
var user_id = '.get_current_user_id().'; | |
</script> |
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
// https://wordpress.stackexchange.com/questions/87261/checkboxes-in-registration-form | |
// REGISTRATION | |
add_action( 'register_form', 'signup_fields_wpse_87261' ); | |
add_action( 'user_register', 'handle_signup_wpse_87261', 10, 2 ); | |
// PROFILE | |
add_action( 'show_user_profile', 'user_field_wpse_87261' ); |
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
$post_id = get_field('above_footer'); | |
$vcM = Vc_Manager::getInstance(); | |
$vc = $vcM->vc(); | |
$vc->addShortcodesCustomCss( $post_id ); | |
$post = get_post($post_id, OBJECT); | |
$content = $post->post_content; | |
$content = apply_filters('wpautop', $content); |
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
// https://stackoverflow.com/questions/6401268/how-do-i-select-the-last-child-with-a-specific-class-name-in-css | |
if ( $( "section.recipe-collections" ).length > 1 ) { | |
$( "section.recipe-collections" ).last().addClass( "last" ); | |
} | |
// Allows the selection of the last element with specific class. |
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
<select name="cat" onChange="window.document.location.href=this.options[this.selectedIndex].value;"> | |
<?php | |
$args = array( | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'hide_empty' => 1, | |
); | |
$categories = get_categories($args); | |