From 6cc8f56034d7a2a450c5c89ab0fcdf2094ef7cd0 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Fri, 17 Aug 2018 15:25:50 -0400 Subject: [PATCH] Add custom link to sidebar under Visit & Explore page --- functions.php | 24 ++++++++++++++++++++++-- header.php | 2 +- js/app.js | 9 +++------ js/custom/pageSetup.js | 9 +++------ sidebar.php | 12 +++++++++++- style.css | 2 +- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/functions.php b/functions.php index a43f756..a25a220 100644 --- a/functions.php +++ b/functions.php @@ -185,7 +185,7 @@ function glm_site_scripts() wp_enqueue_script('jquery'); wp_enqueue_script( 'glm_foundation', - get_template_directory_uri() . '/js/app.js?v=1.2.45', + get_template_directory_uri() . '/js/app.js?v=1.2.46', 'jquery', '1.0', true @@ -197,7 +197,7 @@ function glm_site_scripts() ); wp_enqueue_script( 'glm_foundation', - get_template_directory_uri() . '/js/app.js?v=1.2.45', + get_template_directory_uri() . '/js/app.js?v=1.2.46', 'jquery', '1.0', true @@ -271,6 +271,26 @@ function custom_upload_mimes ( $existing_mimes=array() ) //} //add_action('admin_init', 'redirect_user_on_role'); +/* + * This function returns true when the current page is the page given by ID + * or a descendent thereof. + */ +if (!function_exists('is_in_tree')) { + function is_in_tree( $pid ) { + global $post; + if ( is_page($pid) ) { + return true; + } + $anc = get_post_ancestors( $post->ID ); + foreach ( $anc as $ancestor ) { + if( is_page() && $ancestor == $pid ) { + return true; + } + } + return false; + } +} + add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 20;' ), 20 ); add_filter( 'woocommerce_output_related_products_args', 'woo_related_products_limit' ); diff --git a/header.php b/header.php index 40b62ed..6f9b41e 100644 --- a/header.php +++ b/header.php @@ -4,7 +4,7 @@ <?php wp_title(); ?> - + diff --git a/js/app.js b/js/app.js index e021796..1333156 100644 --- a/js/app.js +++ b/js/app.js @@ -18,10 +18,7 @@ $(document).ready(function () { $(this).siblings('ul').toggleClass('open'); }); - var childTarget = $('#page-header .top-bar .top-bar-section > ul:nth-of-type(1) > li:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(7)'); - childTarget.before( $( '' ) ); - - //console.log(dropdownTarget); - - // + let childTarget = $('#page-header .top-bar .top-bar-section > ul:nth-of-type(1) > li:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(7)'); + let customLink = $( '' ); + childTarget.before( customLink ); }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index c242d21..3dba5f8 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -9,10 +9,7 @@ $(document).ready(function () { $(this).siblings('ul').toggleClass('open'); }); - var childTarget = $('#page-header .top-bar .top-bar-section > ul:nth-of-type(1) > li:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(7)'); - childTarget.before( $( '' ) ); - - //console.log(dropdownTarget); - - // + let childTarget = $('#page-header .top-bar .top-bar-section > ul:nth-of-type(1) > li:nth-of-type(1) > ul:nth-of-type(1) > li:nth-of-type(7)'); + let customLink = $( '' ); + childTarget.before( customLink ); }); diff --git a/sidebar.php b/sidebar.php index 3581d77..23fdb36 100644 --- a/sidebar.php +++ b/sidebar.php @@ -50,4 +50,14 @@ if (!is_page('sponsors')) { echo '

Sponsors

'; }?> - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/style.css b/style.css index c0d09ba..686c9c0 100644 --- a/style.css +++ b/style.css @@ -3,5 +3,5 @@ Theme Name: Gilmore Car Museum Author: Gaslight Media Author URI: http://www.gaslightmedia.com Description: A theme created for Gilmore Car Museum. -Version: 1.2.45 +Version: 1.2.46 */ -- 2.17.1