Skip to content

Instantly share code, notes, and snippets.

View n7studios's full-sized avatar

Tim Carr n7studios

View GitHub Profile
<?php
/**
* For developers who want to display a Post's rating in a specific place, and do not wish to
* use Shortcodes, the below code can be used.
*
* There must be a Field Group configured at Comment Rating Field Pro > Field Groups to display
* rating fields for the Post Type of the Post ID specified.
*/
if ( function_exists( 'display_average_rating' ) ) {
display_average_rating( array(
<?php
/**
* For developers and themes which do not make use of the WordPress comment_form() function,
* the below code can be added to your theme's comment form.
*
* There must be a Field Group configured at Comment Rating Field Pro > Field Groups to display
* rating fields for the Post Type the visitor is viewing.
*/
if ( function_exists( 'display_rating_fields' ) ) {
echo display_rating_fields();
@n7studios
n7studios / wp-dropdown-categories-aria-label.php
Last active November 23, 2023 21:55
WordPress: Add the aria-label attribute to wp_dropdown_categories(): https://www.n7studios.co.uk/adding-aria-labels-wp_dropdown_categories/
<?php
/**
* If the aria-label argument has been specified in a wp_dropdown_categories() call,
* output the aria-label option in the <select>
*
* @since 1.0.0
*
* @param string $output HTML Output
* @param array $arguments wp_dropdown_category() arguments
* @return string Modified HTML Output
<?php
/**
* Adds a title attribute to iframe oembeds
*
* @since 1.0.0
*
* @param string $html HTML
* @param string $url URL to embed
* @param array $attributes HTML Attributes
* @param int $post_id Post ID
@n7studios
n7studios / iframe-oembed.php
Created July 25, 2017 19:25
Add title attribute to WordPress iframe oembeds
<?php
/**
* Adds a title attribute to iframe oembeds
*
* @since 1.0.0
*
* @param string $html HTML
* @param string $url URL to embed
* @param array $attributes HTML Attributes
* @param int $post_id Post ID
@n7studios
n7studios / wp-dropdown-categories-accessibility.php
Last active July 25, 2017 19:16
Add aria-label to wp_dropdown_categories()
<?php
/**
* If the aria-label argument has been specified in a wp_dropdown_categories() call,
* output the aria-label option in the <select>
*
* @since 1.0.0
*
* @param string $output HTML Output
* @param array $arguments wp_dropdown_category() arguments
* @return string Modified HTML Output
@n7studios
n7studios / the-events-calendar-categories.php
Created May 25, 2017 08:59
The Events Calendar: Categories
<?php
/**
* Plugin Name: The Events Calendar: Categories
* Plugin URI: http://www.n7studios.co.uk
* Version: 1.0.0
* Author: n7 Studios
* Author URI: http://www.n7studios.co.uk
* Description: Register WordPress' Categories Taxonomies for The Events Calendar
*/
@n7studios
n7studios / bcc-parking.php
Created May 8, 2017 23:57
Birmingham City Council Live Car Park Status
<?php
class BCC_Parking {
public function get() {
// Fetch JSON
$url = 'http://butc.opendata.onl/UTMC%20parking.json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@n7studios
n7studios / crfp-remove-schema-markup-shortcodes.php
Created January 12, 2017 18:50
Comment Rating Field Pro - Remove Schema Markup from Shortcodes
<?php
/**
* Plugin Name: Comment Rating Field Pro: Remove Schema Markup from Shortcodes
* Plugin URI: http://www.wpcube.co.uk/plugins/comment-rating-field-pro-plugin
* Version: 1.0.0
* Author: WP Cube
* Author URI: http://www.wpcube.co.uk
* Description: Removes schema markup from shortcodes. Requires CRFP Pro 3.4.0+
*/
@n7studios
n7studios / page-generator-pro-dequeue-google-maps-js.php
Created October 13, 2016 09:08
Page Generator Pro - Deregister / Dequeue Google Maps JS
<?php
/**
* Plugin Name: Page Generator Pro - Deregister / Dequeue Google Maps JS
* Plugin URI: http://www.wpcube.co.uk/plugins/page-generator-pro
* Version: 1.0.0
* Author: WP Cube
* Author URI: http://www.wpcube.co.uk
* Description: Page Generator Pro - Deregister / Dequeue Google Maps JS
*/