Skip to content

Instantly share code, notes, and snippets.

View JMWebDevelopment's full-sized avatar

Jacob Martella Web Development JMWebDevelopment

View GitHub Profile
class JM_Portfolio_Blocks {
protected $loader;
protected $directory_location;
public function __construct() {
$this->directory_location = str_replace( '/blocks/', '', dirname( __FILE__ ) );
}
public function jm_portfolio_add_scripts() {
@JMWebDevelopment
JMWebDevelopment / Sports Bench Game Admin Customizations
Created May 14, 2022 14:44
Sports Bench Game Admin Customizations
function open_cup_edit_game_details( $game ) {
?>
<div class="game-details">
<h2><?php esc_html_e( 'Game Information', 'sports-bench' ); ?></h2>
<div class="field one-column">
<label for="game-status"><?php esc_html_e( 'Status', 'sports-bench' ); ?></label>
<select id="game-status" name="game_status">
<option value="" <?php selected( $game['game_status'], '' ); ?>><?php esc_html_e( 'Select a Status', 'sports-bench' ); ?></option>
<option value="scheduled" <?php selected( $game['game_status'], 'scheduled' ); ?>><?php esc_html_e( 'Scheduled', 'sports-bench' ); ?></option>
<option value="in_progress" <?php selected( $game['game_status'], 'in_progress' ); ?>><?php esc_html_e( 'In Progress', 'sports-bench' ); ?></option>
@JMWebDevelopment
JMWebDevelopment / WP REST API Controller Class
Created December 21, 2017 01:47
This is the base WP REST API Controller class
<?php class Sports_Bench_Team_REST_Controller extends WP_REST_Controller {
/**
* Register the routes for the objects of the controller.
*/
public function register_routes() {
$namespace = 'sportsbench';
$base = 'teams';
register_rest_route( $namespace, '/' . $base, array(
array(
<?php
/**
* WP_Rig\WP_Rig\Theme class
*
* @package wp_rig
*/
namespace WP_Rig\WP_Rig;
use InvalidArgumentException;
@JMWebDevelopment
JMWebDevelopment / Custom WP Rig Component
Created August 22, 2020 22:20
/inc/Categories/Component.php
<?php
/**
* WP_Rig\WP_Rig\Categories\Component class
*
* @package wp_rig
*
* This file should be inside your /inc/Categories directory.
*/
namespace WP_Rig\WP_Rig\Categories;
wp_localize_script(
'sportsbench-blocks-js',
'sportsbench_globals',
[
'rest_url' => esc_url( rest_url() ),
'nonce' => wp_create_nonce( 'wp_rest' ),
'sport' => get_option( 'sports-bench-sport' )
]);
<?php
/**
* Sports-bench-team-rest-controller.php
*
* Creates a REST API controller for teams
*
* @package Sports Bench
*
* @author Jacob Martella
*
jQuery( function() {
$( ".sports-bench-playoff-modal" ).dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'jquery-ui-dialog' );
wp_enqueue_style( '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' );
function sports_bench_do_playoff_series_modal( $html, $series, $team_one, $team_one_name, $team_two, $team_two_name, $game_numbers ) {
$html .= '<div class="reveal sports-bench-playoff-modal" id="series-' . $series->series_id . '" data-reveal>';
$html .= '<table class="series-modal-top">';
$html .= '<tr>';
$html .= '<td class="modal-logo">' . $team_one->get_team_photo( 'team-logo' ) . '</td>';
$html .= '<td class="modal-team-name team-one-name">' . $team_one_name . '</td>';
$html .= '<td class="modal-score">' . $series->get_series_score() . '</td>';
$html .= '<td class="modal-team-name team-two-name">' . $team_two_name . '</td>';
$html .= '<td class="modal-logo">' . $team_two->get_team_photo( 'team-logo' ) . '</td>';
$html .= '</tr>';