Skip to content

Instantly share code, notes, and snippets.

// Inject partials into main menu
add_filter('wp_nav_menu_items', function ($items, $args) {
if ($args->menu->name != 'Primary') {
return $items;
}
$dom = new DOMDocument();
$dom->loadHTML($items);
$xpath = new DOMXpath($dom);
$find = $xpath->query('//li[contains(@class, "product-menu")]|//li[contains(@class, "resource-menu")]');
public function getFeaturedImageAttribute() {
if (!empty($this->thumbnail)) {
return $this->thumbnail->size('original');
} else {
return null;
}
}
public function createObject() {
$object = [
'_id' => $this->id,
'_type' => 'employee',
'name' => $this->name,
'slug' => $this->slug,
];
return $object;
}
class Category extends \Corcel\Model\Taxonomy {
public function getIdAttribute() {
return $this->term_id;
}
public function getTitleAttribute() {
return $this->name;
}
public function createObject() {
protected function setupCategories() {
$categories = Category::where('taxonomy', 'category')->get();
foreach($categories as $category) {
$data = $category->createObject();
array_push($this->dataObject, $data);
}
}
animation: navigation-base 1s 1;
@keyframes navigation-base {
0% {
width: 0px;
height: 0px;
box-shadow: 0px;
}
40% {
width: 100%;
{
"autoload": {
"psr-4": {
"Sample\\": "src/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"illuminate/database": "^7.14.1"
<?php
/**
* Plugin Name: Sample Plugin
* Description: A sample plugin
* Version: 1.0
*/
require_once __DIR__ . '/vendor/autoload.php';
$plugin = new \Sample\Loader(__DIR__, plugin_dir_url(__FILE__));
<?php
namespace Sample;
use \Illuminate\Database\Capsule\Manager as Capsule;
class Loader {
public function init() {
$this->initEloquent();
$this->initActions();
$this->initFilters();