public function add_passport_column() { \Jigsaw::add_column('promo', 'Passport', function ($pid) { // This is a render callback $data = array(); $data = new \TimberPost($pid); if (null !== json_decode($data->selected_passport)) { $object = json_decode($data->selected_passport); echo isset($object->title) ? $object->title : $object->id; } else { echo "No Passport"; } }, 5); }
public static function apply_admin_customizations() { if (class_exists('Jigsaw')) { Jigsaw::add_column('highlights', 'Thumb', function ($pid) { $data = array(); $data['post'] = new TimberPost($pid); Timber::render('admin/portfolio-square-preview.twig', $data); }, -1000); Jigsaw::add_column('portfolio', 'Preview', function ($pid) { $data = array(); $data['post'] = new TimberPost($pid); Timber::render('admin/portfolio-square-preview.twig', $data); }, -1000); if (method_exists('Jigsaw', 'add_css')) { Jigsaw::add_css('/wp-content/themes/blades/css/admin.css'); } } }
function add_apple_news_status_column($post_type) { \Jigsaw::add_column($post_type, 'Apple News Status', function ($pid) { $apple_id = get_post_meta($pid, 'apple_news_api_id'); if ($apple_id) { $last_modified = get_post_meta($pid, 'apple_news_api_modified_at')[0]; $post_created = get_post_meta($pid, 'apple_news_api_created_at')[0]; $time_ago = new \TimeAgo(); $last_update = $time_ago->inWords($last_modified); $created = $time_ago->inWords($post_created); echo "<strong>Status:</strong></br>"; echo "<span style='color:green;'>Synced</span></br>"; echo "<hr>"; echo "<strong>Created:</strong></br>"; echo "<span title='{$post_created}'> {$created}</span></br>"; echo "<hr>"; echo "<strong>Last Modified:</strong></br>"; echo "<span title='{$last_modified}'>{$last_update}</span></br>"; } else { echo "<span>Not synced</span>"; } }, 5); }
public static function add_versioning($gitPath, $pathFromRoot = '/') { $db = ''; if (is_multisite()) { $db = get_site_option('database_version'); } else { $db = get_option('database_version'); } if (!strlen($db)) { Jigsaw::show_notice('Database version not found'); } add_filter('update_footer', function ($default) use($gitPath, $pathFromRoot, $db) { // SQL row with the meta_key of "database_version," located in the "sitemeta" sql table // Edit that row every time you export a database for handoff $gitPath = trailingslashit($gitPath) . 'commit/'; $gitMeta = ''; exec('cd ' . ABSPATH . $pathFromRoot . '; git rev-parse --verify HEAD 2> /dev/null', $output); $hash = substr($output[0], 0, 6); // $gitMeta = if(isset($meta)) {'by ' . $meta . ', '}; // exec('cd ' . $_SERVER["DOCUMENT_ROOT"] . '/wp-content/themes; git log -1 --pretty=format:"%an, %ar"', $meta); $db = apply_filters('jigsaw_versioning_database', $db); $commit = ', <strong>Code Commit:</strong> ' . '<a href="' . $gitPath . $output[0] . '">' . $hash . '</a>, ' . $gitMeta; $return = '<strong>Database:</strong> ' . $db . $commit . $default; return $return; }, 11); }
<?php //add menus to site add_theme_support('menus'); add_theme_support('post-thumbnails'); Jigsaw::add_column('roundtable', 'Stories', function ($post_id) { $roundtable = new ClientCustomPostClass($post_id); foreach ($roundtable->get_roundtable_children() as $child) { echo '<a href="' . $child->edit_link() . '">' . $child->post_title . '</a></li>'; } }); Jigsaw::add_column('event', 'Units', function ($post_id) { $page = get_post($post_id); echo the_field('#_of_units'); }, 3); function register_theme_menus() { register_nav_menus(array('primary-menu' => _('Primary Menu'))); } add_action('init', 'register_theme_menus'); //to import CSS and fonts function load_fonts() { wp_register_style('googleFonts', 'https://fonts.googleapis.com/css?family=Signika:400,300,600,700'); wp_enqueue_style('googleFonts'); } add_action('wp_print_styles', 'load_fonts'); function auction_theme_styles() { wp_enqueue_style('smoothness_css', 'http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); wp_enqueue_style('normalize_css', get_template_directory_uri() . '/css/normalize.css');
function swsctp_class_column_mod() { if (class_exists('Jigsaw')) { Jigsaw::add_column('tribe_events', 'Instructor(s)', function ($post_id) { $tribe_events_inst1 = get_post_meta($post_id, '_tribe_events_inst1', TRUE); $tribe_events_inst2 = get_post_meta($post_id, '_tribe_events_inst2', TRUE); $tribe_events_inst3 = get_post_meta($post_id, '_tribe_events_inst3', TRUE); $tribe_events_inst1_stat = get_post_meta($post_id, '_tribe_events_inst1_stat', TRUE); $tribe_events_inst2_stat = get_post_meta($post_id, '_tribe_events_inst2_stat', TRUE); $tribe_events_inst3_stat = get_post_meta($post_id, '_tribe_events_inst3_stat', TRUE); $user_data1 = get_userdata($tribe_events_inst1); $user_data2 = get_userdata($tribe_events_inst2); $user_data3 = get_userdata($tribe_events_inst3); if ($user_data1->last_name !== null) { echo "<span class='tribe_inst {$tribe_events_inst1_stat}'>" . $user_data1->last_name . ", " . $user_data1->first_name . "</span>"; if ($user_data2->last_name !== null) { echo "<br><span class='tribe_inst {$tribe_events_inst2_stat}'>" . $user_data2->last_name . ", " . $user_data2->first_name . "</span>"; if ($user_data3->last_name !== null) { echo "<br><span class='tribe_inst {$tribe_events_inst3_stat}'>" . $user_data3->last_name . ", " . $user_data3->first_name . "</span>"; } } } else { echo "None Assigned"; } }, 2); Jigsaw::add_column('tribe_events', 'Status', function ($post_id) { $tribe_events_status = get_post_meta($post_id, '_tribe_events_status', TRUE); if ($tribe_events_status == "scheduled") { $status = "Scheduled"; } else { if ($tribe_events_status == "cancelled") { $status = "Cancelled"; } else { if ($tribe_events_status == "completed") { $status = "Completed"; } } } echo $status; }, 3); Jigsaw::add_column('tribe_events', 'Class Date', function ($post_id) { $class_date = tribe_get_start_date($post_id); echo $class_date; }, 4); Jigsaw::add_column('tribe_events', 'Location', function ($post_id) { $venue = tribe_get_venue($post_id); $location = tribe_get_full_address($post_id, true); echo $venue . "<br>" . $location; }, 5); Jigsaw::add_column('tribe_events', 'Date Added', function ($post_id) { $pfx_date = get_the_date('m/d/Y', $post_id); echo $pfx_date; }, 10); Jigsaw::remove_column('tribe_events', 'comments'); Jigsaw::remove_column('tribe_events', 'author'); Jigsaw::remove_column('tribe_events', 'feature'); Jigsaw::remove_column('tribe_events', 'image'); Jigsaw::remove_column('tribe_events', 'thumb'); Jigsaw::remove_column('tribe_events', 'thumbnail'); Jigsaw::remove_column('tribe_events', 'date'); Jigsaw::remove_column('tribe_events', 'start-date'); Jigsaw::remove_column('tribe_events', 'end-date'); Jigsaw::remove_column('tribe_events', 'tags'); } }
function add_tags() { \Jigsaw::add_column('pugpig_edition', 'Tags', function ($pid) { echo wp_get_post_tags($pid); }); }
public function interpret($variables, Jigsaw $jigsaw) { global $ONCE_ONLY; if (!isset($ONCE_ONLY[$this->_tag])) { $ONCE_ONLY[$this->_tag] = true; return $jigsaw->interpret($this->_content, $variables); } else { return null; } }
<?php /** * @wordpress-plugin * Plugin Name: Agreable Instant Articles Plugin * Description: A WordPress plugin to generate Instant Articles Format content. * Version: 1.0.0 * Author: Shortlist Media * Author URI: http://shortlistmedia.co.uk/ * License: MIT */ if (file_exists(__DIR__ . '/vendor/autoload.php')) { require_once __DIR__ . '/vendor/autoload.php'; } else { require_once __DIR__ . '/../../../../vendor/autoload.php'; } if (file_exists(__DIR__ . '/vendor/getherbert/framework/bootstrap/autoload.php')) { require_once __DIR__ . '/vendor/getherbert/framework/bootstrap/autoload.php'; } else { require_once __DIR__ . '/../../../../vendor/getherbert/framework/bootstrap/autoload.php'; } if (!getenv('FB_INSTANT_ARTICLES_DEVELOPMENT_MODE')) { \Jigsaw::show_notice("<b>NOTICE</b>: FB_INSTANT_ARTICLES_DEVELOPMENT_MODE missing from .env", 'error'); }