Coder Social home page Coder Social logo

ucf / ucf-spotlights-plugin Goto Github PK

View Code? Open in Web Editor NEW
0.0 8.0 2.0 669 KB

Wordpress plugin for creating and displaying stylized spotlight content on UCF websites.

PHP 95.63% JavaScript 4.37%
wordpress-plugin wordpress ucf-cm athena-framework hacktoberfest

ucf-spotlights-plugin's Introduction

UCF Spotlights Plugin

Provides a custom post type, shortcode and functions for displaying Spotlights.

Description

Adds a new post type called Spotlights that can be added to pages using a [ucf-spotlight] shortcode. Spotlights may optionally contain a header, copy, link and featured image.

The [ucf-spotlight] shortcode has one option:

  • slug - the slug of the spotlight to be displayed

Installation

Manual Installation

  1. Upload the plugin files (unzipped) to the /wp-content/plugins directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the "Plugins" screen in WordPress

WP CLI Installation

  1. $ wp plugin install --activate https://github.com/UCF/UCF-Spotlights-Plugin/archive/master.zip. See WP-CLI Docs for more command options.

Changelog

2.1.1

Enhancements:

  • Added composer file.

2.1.0

Enhancements:

  • Added a new default template for single Spotlights to allow for previews to function properly if the active theme hasn't already defined one (fixes "blank page" bug when viewing a single Spotlight).
  • Added a <meta name="robots" content="noindex,nofollow"> tag to the document head on single Spotlights. Supports Yoast if activated.
  • Added excludes for Spotlights from sitemaps (WP 5.5+, or Yoast if activated)
  • Added some overrides to Yoast settings for Spotlights to force admin toggles to specific values.
  • Updated the main plugin file to use absolute paths for require_once's.
  • Upgraded packages

2.0.7

Documentation:

  • Updated contributing doc to reflect the switch from slack to teams.

2.0.6

Enhancements:

  • Added Github Updater support.
  • Upgraded project packages.
  • Added PR and issue templates, CONTRIBUTING doc, and linter configs to the project.

Bug fixes:

  • Added d-block class to links surrounding vertical and square Spotlights to ensure an appropriate outline is always visible when those links are focused via keyboard.

2.0.5

Enhancements:

  • Added role="note" to <aside> elements in each Spotlight layout to remove ARIA landmark associations.

2.0.4

Bug Fixes:

  • Disabled archives by default.

2.0.3

Bugfixes:

  • Fixed output of [ucf-spotlight] when the requested spotlight post does not exist

2.0.2

Enhancements:

  • Added minor accessibility improvements to square and vertical spotlight layouts
  • Removed faux buttons from square spotlights if a Link URL isn't provided

Bug Fixes:

  • Fixed issue with spotlight meta fields not allowing empty values to be saved

2.0.1

Enhancements:

  • Added missing plugin description

2.0.0

This release contains breaking changes from v1.0.3 and older. Please review notes below before upgrading:

Enhancements:

  • Updates the plugin to remove all fallback styles. The plugin now requires using a theme that loads the Athena Framework.
  • The plugin options page in the WordPress admin has been removed, since there are no longer any configurable plugin-level settings.
  • Adds a unique layout hook for each layout (ucf_spotlight_display_square, ucf_spotlight_display_horizontal, and ucf_spotlight_display_vertical), replacing the previous ucf_spotlight_display hook that handled all three.
  • Adds new layout-specific thumbnail sizes that are sized appropriately for the given layout (ucf-spotlight-square, ucf-spotlight-horizontal, and ucf-spotlight-vertical).
  • Adds minor markup adjustments to each spotlight for consistency across each layout, to take advantage of Athena classes, and to fix some minor bugs (e.g. hover states). All spotlights are now wrapped in an <aside> tag, and the horizontal layout no longer includes top-level closing divs (these can be handled at the theme level if needed).

1.0.3

Bug Fixes:

  • Debug log cleanup

1.0.2

Bug Fixes:

  • Fixed shorthand PHP tag usage (thanks @strmtrpr83)

1.0.1

Bug Fixes:

  • Fixes #3 by adding necessary variables and making UCF_Spotlight_Common::enqueue_styles static.
  • Added comments.

1.0.0

  • Initial release

Upgrade Notice

2.0.0

The UCF-Spotlights-Plugin now requires the Athena Framework to display Spotlight styles properly. Please see release notes for v2.0.0 for other breaking changes.

Installation Requirements

  • Any theme that loads the Athena Framework

Development & Contributing

NOTE: this plugin's readme.md file is automatically generated. Please only make modifications to the readme.txt file, and make sure the gulp readme command has been run before committing readme changes.

ucf-spotlights-plugin's People

Contributors

cjg89 avatar jmbarne3 avatar mcatech avatar rjucf avatar strmtrpr83 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ucf-spotlights-plugin's Issues

Single Spotlights are publicly accessible by default

Describe the bug

Without the use of a theme that provides a custom post template for Spotlights and a third-party plugin that disables crawling of single Spotlights, Spotlights are accessible publicly (and crawled) with a blank page template.

Steps to Reproduce

n/a

Expected Behavior

Spotlights should at least be accessible to logged-in users to be able to preview their changes, but single Spotlights should not be crawled by Google or included in generated sitemaps.

Possible Fix

Ideally, this plugin should provide a fallback template for previewing single Spotlights, but ensure that it is not crawled or added to sitemaps.

We cannot set publicly_queryable=false on the Spotlight post type; see comments on #32 for more info.

Your environment:

(all)

Additional context

#32

Allow single layouts to be overridable via unique hooks

Unless I'm missing something, it looks like the only layout hook for spotlights currently is ucf_spotlight_display, which requires you to perform fetches for any relevant post meta yourself in a theme and then add a layout override based on the spotlight's layout meta value. It would be nice if each type of spotlight had its own hook (e.g. ucf_spotlight_display_vertical) which had the spotlight's metadata passed to it out of the box.

Fix notices

Notice: Undefined variable: singular in /wp-content/plugins/UCF-Spotlights-Plugin/includes/ucf-spotlight-posttype.php on line 221

Notice: Undefined variable: plural in /wp-content/plugins/UCF-Spotlights-Plugin/includes/ucf-spotlight-posttype.php on line 221

Notice: Undefined variable: post_type in /wp-content/plugins/UCF-Spotlights-Plugin/includes/ucf-spotlight-posttype.php on line 221

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UCF_Spotlight_Common::enqueue_styles() should not be called statically in /wordpress/wp-includes/class-wp-hook.php on line 298

Links surrounding spotlights must be set to display:block to show outlines correctly

The outline property will fail to wrap correctly around link-wrapped spotlights, due to links being inline elements. This results in outlines on focus not surrounding spotlights properly; in the case of square spotlights, they're not visible at all.

Examples of current focus states:

Vertical:
Screen Shot 2019-10-16 at 4 50 43 PM

Square:
Screen Shot 2019-10-16 at 4 51 15 PM

The horizontal layout is not affected since that layout doesn't have a link wrapped around it.

Adjust ARIA roles on Spotlight aside elements

<aside> elements generated by the 3 spotlight layouts inherit a landmark role (complementary), which requires a unique label (aria-label or aria-labelledby) to be defined when used on a page with other landmarks.

The simplest way to fix this issue would be to apply role="note" to all generated <aside>s; this will help preserve its semantics as a tangentially-related piece of content to the rest of the article, while removing the landmark navigation association with the role. This role may not be perfect for every scenario, but in most cases, we probably don't want aside content to be landmark content.

Alternatives would include adding an aria-label, and/or using role="region", though this will still result in the element having a landmark role, and we may not be able to implement labels in a meaningful backward-compatible way (for instance, existing Spotlights may have titles that are not intended for front-end consumption.)

See https://fae.disability.illinois.edu/rulesets/ROLE_7/ for more info.

Fix notices - trying to get property of non-object

Notice: Trying to get property of non-object in UCF-Spotlights-Plugin/includes/ucf-spotlight-common.php on line 39

Notice: Trying to get property of non-object in UCF-Spotlights-Plugin/includes/ucf-spotlight-common.php on line 42

Notice: Trying to get property of non-object in UCF-Spotlights-Plugin/includes/ucf-spotlight-common.php on line 43

Notice: Trying to get property of non-object in UCF-Spotlights-Plugin/includes/ucf-spotlight-common.php on line 44

Notice: Trying to get property of non-object in UCF-Spotlights-Plugin/includes/ucf-spotlight-common.php on line 45

Notice: Trying to get property of non-object in UCF-Spotlights-Plugin/includes/ucf-spotlight-common.php on line 46

Spotlight meta fields cannot be updated to empty values

Steps to reproduce:

  • Create and save a new spotlight with at least one optional meta field filled out with a value
  • Delete one optional meta field value and save
  • After saving, the previous meta field value is left intact

Pre-closing of wrapper divs for horizontal spotlights should probably be added per-theme

https://github.com/UCF/UCF-Spotlights-Plugin/blob/master/includes/ucf-spotlight-common.php#L79-L84

The current horizontal spotlight layout assumes all preceding post contents will be wrapped in three wrapper divs (presumably .container, .row, and .col). This should probably be handled at the theme level as a layout override if div closures are needed--right now, the new main site will not have three wrapper divs to close, which will cause malformed markup and potential cross-browser rendering inconsistencies.

Add Ability to Control Styles on Spotlights

Description
Add the ability to control the styles of header text, body copy and the button.

Why it's Important
Style changes to the copy/buttons allows more creative freedom when choosing bg images, can help with readability and can improve the look of spotlights.

Possible Implementation

  • Add fields similar to the ucf-section plug.
  • Allow html in the current header, body and button fields (it's currently getting run through sanitize_text_field so it strips html).

Additional context

Link surrounding .spotlight-square has no class/is not editable; shows underline on hover

<a> tags surrounding square spotlight markup have no classes at all, making them uneditable via css in themes.

Unless a theme using square spotlights disables text-decoration: underline on the global a element, the inner spotlight's contents will always display an underline on hover.

screen shot 2017-09-29 at 2 16 12 pm

Having text-decoration: none on the wrapper link by default is probably desirable in all use cases. Additionally, having some unique class on the element will make it possible to make other link-based overrides in themes.

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.