Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1 from cmc12028/master
Graduate School Initial Commit
  • Loading branch information
bcd04001 committed Mar 31, 2017
2 parents c838e50 + 69cbec5 commit 8f8c42c
Show file tree
Hide file tree
Showing 11 changed files with 2,919 additions and 8 deletions.
6 changes: 6 additions & 0 deletions _notes/dwsync.xml
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="grandchild-styles.css" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131354477909580594" remote="131354477900000000" Dst="2" />
<file name="template-class.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131169568800000000" remote="131169604800000000" Dst="1" />
<file name="grandchild-functions.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131208603859143420" remote="131208639850000000" Dst="1" />
</dwsync>
126 changes: 126 additions & 0 deletions grandchild-functions.php
@@ -0,0 +1,126 @@
<?php
/*
Plugin Name: Grad School 2016
Description: Grandchild Plugin for Grad School
Author: Web Dev & Chris Cerrigione
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_grad2016', 'get_instance' ) );

// Adds our new file with styles
function grandchild_add_scripts_styles_grad2016() {
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_grad2016', 99999999 );

// Search for templates in plugin 'templates' dir, and load if exists
function grandchild_template_include_grad2016( $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_grad2016', 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- creates widget in header for tagline -----------------

if ( function_exists('register_sidebar') ) {
register_sidebar( array(
'name' => __( 'Header - Tagline' ),
'id' => 'header-tagline',
'description' => __( 'Widgets in this area will be shown on the header.' ),
'before_title' => '<h1>',
'after_title' => '</h1>',
) );
}

if ( function_exists('register_sidebar') ) {
register_sidebar( array(
'name' => __( 'Footer - 1' ),
'id' => 'footer-1',
'description' => __( 'Widgets in this area will be shown on the left hand side of the footer.' ),
'before_title' => '<h2>',
'after_title' => '</h2>',
) );

register_sidebar( array(
'name' => __( 'Footer - 2' ),
'id' => 'footer-2',
'description' => __( 'Widgets in this area will be shown on the right hand side of the footer.' ),
'before_title' => '<h2>',
'after_title' => '</h2>',
) );

register_sidebar( array(
'name' => __( 'Footer - 3' ),
'id' => 'footer-3',
'description' => __( 'Widgets in this area will be shown on the right hand side of the footer.' ),
'before_title' => '<h2>',
'after_title' => '</h2>',
) );
}


//---------------- Add templates to post loop drop down -----------------

/* function grandchild_postloop_template_include( $templates ) {
$templates[] = '../../plugins/grandchild-global-citizenship/templates/content-small-grid.php';
$templates[] = '../../plugins/grandchild-global-citizenship/templates/content-large-featured-story.php';
$templates[] = '../../plugins/grandchild-global-citizenship/templates/content-category-landing-grid.php';
return $templates;
}
add_filter( 'siteorigin_panels_postloop_templates', 'grandchild_postloop_template_include', 11 ); */




// ---------------- 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 );


?>

0 comments on commit 8f8c42c

Please sign in to comment.