Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add files via upload
- Loading branch information
Showing
6 changed files
with
1,238 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
/* | ||
Plugin Name: Grandchild - Mechanical Engineering | ||
Description: Grandchild Plugin for Aurora | ||
Author: UConn WebDev | ||
Author URI: http://www.webdev.uconn.edu | ||
Version: 1.0 | ||
*/ | ||
|
||
|
||
require_once( plugin_dir_path( __FILE__ ) . 'template-class.php' ); | ||
add_action( 'plugins_loaded', array( 'Page_Template_Plugin', 'get_instance' ) ); | ||
|
||
// Adds our new file with styles | ||
function grandchild_add_scripts_styles() { | ||
wp_register_script( 'grandchild-script', plugins_url( 'grandchild-scripts.js', __FILE__ ), array( 'jquery' ), '1.0' ); | ||
wp_enqueue_script( 'grandchild-script' ); | ||
|
||
wp_register_style( 'grandchild-style', plugins_url( 'grandchild-styles.css', __FILE__ ), array(), '1.0' ); | ||
wp_enqueue_style( 'grandchild-style' ); | ||
} | ||
add_action( 'wp_enqueue_scripts', 'grandchild_add_scripts_styles', 99999999 ); | ||
|
||
// Search for templates in plugin 'templates' dir, and load if exists | ||
function grandchild_template_include( $template ) { | ||
if ( file_exists( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' . basename( $template ) ) ) | ||
$template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' . basename( $template ); | ||
|
||
$post_types = array('archive'); | ||
if (is_singular($post_types)) { | ||
$template = plugin_dir_path( __FILE__ ).'templates/archive.php'; | ||
} | ||
return $template; | ||
|
||
} | ||
add_filter( 'template_include', 'grandchild_template_include', 11 ); | ||
|
||
function string_limit_words($string, $word_limit) | ||
{ | ||
$words = explode(' ', $string, ($word_limit + 1)); | ||
if(count($words) > $word_limit) | ||
array_pop($words); | ||
return implode(' ', $words); | ||
} | ||
|
||
// ------------------------- Custom Header ------------------------- | ||
|
||
// We are hooking to the 'load_custom_header' filter | ||
// and return a value of 'true' meaning that we want to | ||
// load a custom header | ||
|
||
/* | ||
add_filter( 'load_custom_header', '__return_true', 99 ); | ||
add_filter( 'get_custom_header', function( $header ) { | ||
return plugin_dir_path( __FILE__ ).'templates/header.php'; | ||
}, 99 ); | ||
*/ | ||
|
||
// ------------------------- Register a new sidebar ------------------------- | ||
|
||
/* | ||
if ( function_exists('register_sidebar') ) { | ||
register_sidebar( array( | ||
'name' => __( 'Header - Social Media' ), | ||
'id' => 'header-social', | ||
'description' => __( 'Widgets in this area will be shown on the header.' ), | ||
'before_title' => '<h1>', | ||
'after_title' => '</h1>', | ||
) ); | ||
} | ||
*/ | ||
|
||
//------------------------- Add templates to post loop drop down ------------------------- | ||
|
||
|
||
|
||
function grandchild_postloop_template_include( $templates ) { | ||
$templates[] = '../../plugins/grandchild-mechanical/templates/content-home-three-grid.php'; | ||
return $templates; | ||
|
||
} | ||
|
||
|
||
add_filter( 'siteorigin_panels_postloop_templates', 'grandchild_postloop_template_include', 11 ); | ||
|
||
|
||
|
||
//------------------------- Custom single.php template ------------------------- | ||
|
||
/* | ||
add_filter('template_include', 'my_plugin_templates'); | ||
function my_plugin_templates( $template ) { | ||
$post_types = array('post'); | ||
if (is_singular($post_types)) { | ||
$template = plugin_dir_path( __FILE__ ).'templates/single.php'; | ||
} | ||
return $template; | ||
} | ||
*/ | ||
|
||
// ------------------------- Custom Footer ------------------------- | ||
|
||
/* | ||
add_filter( 'load_custom_footer', '__return_true', 99 ); | ||
add_filter( 'get_custom_footer', function( $footer ) { | ||
return plugin_dir_path( __FILE__ ).'templates/footer.php'; | ||
}, 99 ); | ||
*/ | ||
|
||
?> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
jQuery.noConflict()(function ($) { // this was missing for me | ||
$(document).ready(function() { | ||
function close_accordion_section() { | ||
$('.accordion .accordion-section-title').removeClass('active'); | ||
$('.accordion .accordion-section-content').slideUp(300).removeClass('open'); | ||
} | ||
|
||
$('.accordion-section-title').click(function(e) { | ||
// Grab current anchor value | ||
var currentAttrValue = $(this).attr('href'); | ||
|
||
if($(e.target).is('.active')) { | ||
close_accordion_section(); | ||
} | ||
else if ($(e.target).is('.active img')) { | ||
close_accordion_section(); | ||
} | ||
else { | ||
close_accordion_section(); | ||
|
||
// Add active class to section title | ||
$(this).addClass('active'); | ||
// Open up the hidden content panel | ||
$('.accordion ' + currentAttrValue).slideDown(300).addClass('open'); | ||
} | ||
|
||
e.preventDefault(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.