/**
* PEEDA functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package PEEDA
*/
if ( ! function_exists( 'peeda_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function peeda_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on PEEDA, use a find and replace
* to change 'peeda' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'peeda', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'peeda' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'peeda_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_theme_support('html5', array('search-form'));
}
endif;
add_action( 'after_setup_theme', 'peeda_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function peeda_content_width() {
$GLOBALS['content_width'] = apply_filters( 'peeda_content_width', 640 );
}
add_action( 'after_setup_theme', 'peeda_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function peeda_widgets_init() {
/* Register the primary sidebar. */
register_sidebar(
array(
'id' => 'homepage-sidebar',
'name' => __( 'Homepage Bar', 'cfgorrp' ),
'description' => __( 'Homepage bar for displaying widget', 'textdomain' ),
'before_widget' => '',
'before_title' => ''
)
);
register_sidebar(array(
'name' => 'Footer Widget 1',
'id' => 'footer-1',
'description' => 'First footer widget area',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => 'Footer Widget 2',
'id' => 'footer-2',
'description' => 'Second footer widget area',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => 'Footer Widget 3',
'id' => 'footer-3',
'description' => 'Third footer widget area',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
));
}
add_action( 'widgets_init', 'peeda_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function peeda_scripts() {
wp_enqueue_style( 'peeda-style', get_stylesheet_uri() );
wp_enqueue_script( 'peeda-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'peeda-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_register_script( 'custom-script', get_template_directory_uri() . '/uikit/js/uikit.min.js', array( 'jquery' ) );
wp_enqueue_script( 'custom-script' );
wp_register_script( 'carousel-responsive', get_template_directory_uri() . '/js/jcarousel.responsive.js', array( 'jquery' ) );
wp_enqueue_script( 'carousel-responsive');
wp_register_script( 'carousel', get_template_directory_uri() . '/js/jquery.jcarousel.min.js', array( 'jquery' ) );
wp_enqueue_script( 'carousel');
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'peeda_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'extra-menu' => __( 'Extra Menu' )
)
);
}
add_action( 'init', 'register_my_menus' );
// Register Custom Post Types
add_action('init', 'register_custom_posts_init');
function register_custom_posts_init() {
//Register Activities
$activity_labels = array(
'name' => 'Activities',
'singular_name' => 'Activity',
'menu_name' => 'Activities'
);
$activity_args = array(
'labels' => $activity_labels,
'public' => true,
'capability_type' => 'post',
'has_archive' => true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions' )
);
register_post_type('activity', $activity_args);
//Register EC Members
$ecmem_labels = array(
'name' => 'EC Members',
'singular_name' => 'EC Member',
'menu_name' => 'EC Members'
);
$ecmem_args = array(
'labels' => $ecmem_labels,
'public' => true,
'capability_type' => 'post',
'has_archive' => true,
'show_in_menu' =>true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions','page-attributes' )
);
register_post_type('ec-members', $ecmem_args);
//Register Peeda Staffs
$staffs_labels = array(
'name' => 'PEEDA Staffs',
'singular_name' => 'PEEDA Staff',
'menu_name' => 'PEEDA Staffs'
);
$staffs_args = array(
'labels' => $staffs_labels,
'public' => true,
'capability_type' => 'post',
'has_archive' => true,
'show_in_menu' =>true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions','page-attributes' )
);
register_post_type('peeda-staffs', $staffs_args);
//Register Downloads
$downloads_labels = array(
'name' => 'Downloads',
'singular_name' => 'Download',
'menu_name' => 'Downloads'
);
$downloads_args = array(
'labels' => $downloads_labels,
'public' => true,
'capability_type' => 'post',
'has_archive' => true,
'show_in_menu' =>true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions','page-attributes' )
);
register_post_type('downloads', $downloads_args);
}
add_action( 'init', 'create_activity_taxonomies', 0 );
function create_activity_taxonomies() {
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
'name' => _x( 'Activity Types', 'taxonomy general name' ),
'singular_name' => _x( 'Activity Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Activity Type' ),
'all_items' => __( 'All Activity Types' ),
'parent_item' => __( 'Parent Activity Type' ),
'parent_item_colon' => __( 'Parent Activity Type:' ),
'edit_item' => __( 'Edit Activity Type' ),
'update_item' => __( 'Update Activity Type' ),
'add_new_item' => __( 'Add New Activity Type' ),
'new_item_name' => __( 'New Activity Type Name' ),
'menu_name' => __( 'Activity Types' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'activities' ),
);
register_taxonomy( 'activities', array( 'activity' ), $args );
$labels = array(
'name' => _x( 'Download Types', 'taxonomy general name' ),
'singular_name' => _x( 'Download Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Download Type' ),
'all_items' => __( 'All Download Types' ),
'parent_item' => __( 'Parent Download Type' ),
'parent_item_colon' => __( 'Parent Download Type:' ),
'edit_item' => __( 'Edit Download Type' ),
'update_item' => __( 'Update Download Type' ),
'add_new_item' => __( 'Add New Download Type' ),
'new_item_name' => __( 'New Download Type Name' ),
'menu_name' => __( 'Download Types' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'download-type' ),
);
register_taxonomy( 'download-type', array( 'downloads' ), $args );
}
function my_theme_thumb() {
add_image_size( 'project-image', 400, 280, true );
}
add_action( 'after_setup_theme', 'my_theme_thumb' );
add_action( 'pre_get_posts', 'my_change_sort_order');
function my_change_sort_order($query){
if(is_post_type_archive()):
//If you wanted it for the archive of a custom post type use: is_post_type_archive( $post_type )
//Set the order ASC or DESC
$query->set( 'order', 'ASC' );
//Set the orderby
$query->set( 'orderby', 'menu_order' );
endif;
};
function pagination($pages = '', $range = 2)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo "\n";
}
}
add_filter('ngg_render_template', 'nggTemplateAwesomeness', 10, 2);
/**
* tell NextGEN about our custom template
* @param string $custom_template the path to the custom template file (or false if not known to us)
* @param string $template_name name of custom template sought
* @return string
*/
function nggTemplateAwesomeness($custom_template, $template_name) {
if ($template_name == 'gallery-peeda') {
// see if theme has customised this template
$custom_template = locate_template("nggallery/$template_name.php");
if (!$custom_template) {
// no custom template so set to the default
$custom_template = dirname(__FILE__) . "/$template_name.php";
}
}
return $custom_template;
}Error thrown
Call to undefined function peeda_categorized_blog()