Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
/*
Plugin Name: LUP
Description: Post author and print styles for LUP
Author: UConn Web Dev - Bridget Arrington
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 );
if (is_singular($post_types)) {
$template = plugin_dir_path( __FILE__ ).'templates/single-custom.php';
}
return $template;
}
add_filter( 'template_include', 'grandchild_template_include', 11 );
/********************************************************************
Register Custom Post Type
********************************************************************/
function create_post_type() {
register_post_type( 'posts', array(
'labels' => array(
'name' => __('Custom Posts'),
'singular_name' => __('Custom Post'),
'menu_name' => __('Custom Posts'),
'name_admin_bar' => __('Custom Posts'),
'add_new' => __('Add New'),
'add_new_item' => __('Add New Custom Post'),
),
'description' => 'Post Template for a Custom Post.',
'public' => true,
'has_archive' => true,
// 'rewrite' => array( 'slug' => "graduate-courses/%subjects%", 'with_front' => false),
'capability_type' => 'post',
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'revisions', 'comments' ), // Also author, thumbnail, excerpt, trackbacks, custom-fields, comments, page-attributes, post-formats
'query_var' => true,
'taxonomies' => array('categories'),
) );
flush_rewrite_rules();
};
add_action('init', 'create_post_type');
// Registers the Categories for Custom Posts
function custom_post_categories() {
register_taxonomy('categories', 'posts', array(
'labels' => array(
'name' => __('Categories'),
'singular_name' => __('Category'),
'search_items' => __('Search Categories'),
'all_items' => __('All Categories'),
'parent_item' => __('Category'),
'parent_item_colon' => __('Category:'),
'edit_item' => __('Edit Category'),
'update_item' => __('Update Category'),
'add_new_item' => __('Add New Category'),
'new_item_name' => __('New Category'),
'menu_name' => __('Categories')
),
'hierarchical' => true,
'query_var' => true,
// 'rewrite' => array( 'slug' => 'graduate-courses', 'with_front' => true),
) );
}
add_action('init', 'custom_post_categories', 0);
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_5900ea4331e17',
'title' => 'Author',
'fields' => array (
array (
'key' => 'field_5900ea6191f59',
'label' => 'Author',
'name' => 'author',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array (
'key' => 'field_5900ea7291f5a',
'label' => 'Author Sub Text',
'name' => 'author_sub_text',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'posts',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;