Giter Club home page Giter Club logo

umn-wordpress's Introduction

University WordPress Template

Custom university Wordpress template styled to emulate the University of Minnesota, complete with subjects, professors, events, and blog posts. The code often refers to Hogwarts, which was the original inspiration for the university template.

Languages: PHP, Javascript, Sass, HTML

Features: Live search, custom REST API endpoints, CRUD note-taking, advanced custom fields, custom post types.

I took on this project as part of a Udemy course I used to learn PHP, but quickly added additional features and functionality. I used Local by Flywheel to create my WordPress developer environment.

The project is responsive between mobile and desktop devices, leverages template pages to generate content easily from the WordPress admin dashboard, and intelligently connects the various posts and pages. Professors and subjects refer to one another and so on. See for yourself:

Responsiveness, Taxonomy, and Live Search:

umngithubgif

Custom Post Types There are custom post types enabled for events, professors, subjects, campuses -- as well as notes and likes, enabling some of the cooler features.


        // Note Post Type
        register_post_type( 'note', array(
            'capability_type' => 'note',
            'map_meta_cap' => true, // enforces 'note' permissions, above
            'show_in_rest' => true,
            'supports' => array('title', 'editor'), // 'custom-fields' would go here if not using the Advanced Custom Fields plugin.                 'thumbnail' enables featured images on Professor posts
            'rewrite' => array('slug' => 'notes'),
            'show_ui' => true, // shows in admin dashboard
            'public' => false, // we want notes to be private, not searchable
            'menu_icon' => 'dashicons-welcome-write-blog',
            'labels' => array(
                'name' => 'Notes',
                'add_new_item' => 'Add New Note',
                'edit_item' => 'Edit Note',
                'all_items' => 'All Notes',
                'singular_name' => 'Note'
            )
        ));

         // Like Post Type
         register_post_type( 'like', array(
             
            'supports' => array('title'), // 'custom-fields' would go here if not using the Advanced Custom Fields plugin. 'thumbnail'               enables featured images on Professor posts
            'show_ui' => true, // shows in admin dashboard
            'public' => false, // we want notes to be private, not searchable
            'menu_icon' => 'dashicons-heart',
            'labels' => array(
                'name' => 'Likes',
                'add_new_item' => 'Add New Like',
                'edit_item' => 'Edit Like',
                'all_items' => 'All Likes',
                'singular_name' => 'Like'
            )
        ));

CRUD Note-Taking Notes can be created, edited, deleted. Feature is programmed so only logged-in users can create notes, and they can only post at most 5 notes.

notesgif

Custom REST API Endpoints Edited the WordPress REST API to return the author name so we can display it in search results, as well as a user note counter to verify they have permissions to create a new one.

    function hogwarts_custom_rest() {
        register_rest_field('post', 'authorName', array(
            'get_callback' => function() {return get_the_author();}
        ));

        register_rest_field('note', 'userNoteCount', array(
            'get_callback' => function() {return count_user_posts(get_current_user_id(), 'note');}
        ));
    }

    // customizing the wp REST API
    add_action('rest_api_init', 'hogwarts_custom_rest');

Thanks for reading about my WordPress website! Please check out my other projects, and don't hesitate to drop me a line!

umn-wordpress's People

Contributors

btramel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.