Skip to content

Instantly share code, notes, and snippets.

Takuro Hishikawa hissy

Block or report user

Report or block hissy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hissy
hissy / concrete.php
Last active Jun 20, 2019
#concrete5 Disable getting external news and help from concrete5.org
View concrete.php
<?php
/**
* Put this file at application/config/concrete.php
* Disable getting external news and help from concrete5.org
*/
return [
'marketplace' => [
'enabled' => false
],
'external' => [
@hissy
hissy / nav-menu-exporter-importer.php
Last active Jun 20, 2019
[WordPress Plugin] Nav Menu Exporter and Importer / Export and Import nav menus. Requires WordPress Importer plugin.
View nav-menu-exporter-importer.php
<?php
/*
Plugin Name: Nav Menu Exporter and Importer
Description: Export and Import nav menus. Requires WordPress Importer plugin
Author: hissy, megumi themes
Version: 0.1
Text Domain: nav-menu-exporter-importer
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@hissy
hissy / view.php
Last active Jun 19, 2019
#concrete5 Check the user already submitted on express form template
View view.php
<?php
defined('C5_EXECUTE') or die('Access Denied.');
$app = \Concrete\Core\Support\Facade\Facade::getFacadeApplication();
/** @var \Concrete\Core\User\User $u */
$u = $app->make(\Concrete\Core\User\User::class);
$answered = 0;
if (isset($renderer) && is_object($renderer) && $u->isRegistered()) {
$context = $renderer->getContext();
if (is_object($context)) {
@hissy
hissy / view.php
Created Jun 17, 2019
#concrete5 An example of the custom template for page list with Vue.js
View view.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$c = Page::getCurrentPage();
/** @var \Concrete\Core\Utility\Service\Text $th */
$th = Core::make('helper/text');
/** @var \Concrete\Core\Localization\Service\Date $dh */
$dh = Core::make('helper/date');
@hissy
hissy / view.php
Created Jun 10, 2019
#concrete5 An example of the custom template that rendered by Vue.js
View view.php
<?php
// application/blocks/topic_list/templates/your_template_name.php
use Concrete\Core\Tree\Node\Node;
use Concrete\Core\Tree\Node\Type\Category;
use Concrete\Core\Tree\Type\Topic;
defined('C5_EXECUTE') or die("Access Denied.");
$json = [];
@hissy
hissy / app.php
Created Jun 5, 2019
#concrete5 Switch theme via request path for page not found
View app.php
<?php
// Tested on 8.5.2a1
Events::addListener('on_before_render', function ($event) {
$view = $event->getArgument('view');
if ($view->getViewPath() == '/page_not_found') {
$request = \Request::getInstance();
if ($request->getPath() == '/foo' || $request->matches('/foo/*')) {
$view->setViewTheme('concrete');
@hissy
hissy / clear_empty_workflow_progress.php
Created Mar 21, 2015
A job to deletes empty "Compare Versions" alert.
View clear_empty_workflow_progress.php
<?php
namespace Application\Job;
use Job as AbstractJob;
use Concrete\Core\Workflow\Progress\PageProgress;
use Concrete\Core\Workflow\EmptyWorkflow;
class ClearEmptyWorkflowProgress extends AbstractJob
{
@hissy
hissy / export.xml
Created Apr 15, 2019
An xml file of example Users&Groups for Migration tool #concrete5
View export.xml
<?xml version="1.0" encoding="UTF-8"?>
<concrete5-cif version="1.0">
<groups>
<group name="Administrators" description="" path="/Administrators" package=""/>
<group name="Editors" description="" path="/Editors" package=""/>
<group name="Approvers" description="" path="/Approvers" package=""/>
</groups>
<users>
<user username="editor" email="editor@example.com" language="ja_JP">
<attributes>
@hissy
hissy / gist:3613306
Last active Mar 23, 2019
[WordPress] change next / previous post link ordering
View gist:3613306
<?php
/**
* Customize Adjacent Post Link Order
*/
function my_custom_adjacent_post_where($sql) {
if ( !is_main_query() || !is_singular() )
return $sql;
$the_post = get_post( get_the_ID() );
$patterns = array();
@hissy
hissy / gist:5338996
Last active Mar 22, 2019
#WordPress #ACF Get posts which includes same value of relationship field
View gist:5338996
<?php
// get current post
global $post;
// get custom field data.
// "custom_field_key" is custom field key (ACF relationship field), return value is array of post IDs
$relations = $post->custom_field_key;
//
$meta_array = array();
foreach ((array) $relations as $relation){
You can’t perform that action at this time.